parameters: (method)
return_statement: return wrapper
docstring: Wraps a method. Method will return dictionary with validation results.
      
      The wrapped function MUST NOT be async and MUST NOT be RPC.
docstring_summary: Wraps a method. Method will return dictionary with validation results.
      
      The wrapped function MUST NOT be async and MUST NOT be RPC.
docstring_tokens: Wraps a method . Method will return dictionary with validation results . The wrapped function MUST NOT be async and MUST NOT be RPC .
function: def validated(method):
      """ Wraps a method. Method will return dictionary with validation results.
      
      The wrapped function MUST NOT be async and MUST NOT be RPC.
      """
      @functools.wraps(method)
      def wrapper(self, *args, **kwargs):
          try:
              returned = method(self, *args, **kwargs)
              result = {
                  "success": True,
                  "result": returned
              }
          except ValidationFailedException as e:
              result = {
                  "success": False,
                  "errors": e.errors
              }
          self.write(json.dumps(result))
      return wrapper
function_tokens: def validated ( method ) : @ functools . wraps ( method ) def wrapper ( self , * args , * * kwargs ) : try : returned = method ( self , * args , * * kwargs ) result = { "success" : True , "result" : returned } except ValidationFailedException as e : result = { "success" : False , "errors" : e . errors } self . write ( json . dumps ( result ) ) return wrapper