(method)
return wrapper
Wraps a method. Method will return dictionary with validation results.
    
    The wrapped function MUST NOT be async and MUST NOT be RPC.
Wraps a method. Method will return dictionary with validation results.
    
    The wrapped function MUST NOT be async and MUST NOT be RPC.
Wraps a method . Method will return dictionary with validation results . The wrapped function MUST NOT be async and MUST NOT be RPC .
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
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