File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,8 +63,11 @@ def decode_token(token):
6363 return result
6464 else :
6565 raise Exception ("Invalid token!" )
66+ # https://realpython.com/primer-on-python-decorators/#defining-decorators-with-arguments
6667 @staticmethod
6768 def auth_required (url ):
69+ # The function to decorate is only passed in directly if the decorator is called without arguments
70+ # Return a decorator function that takes a function as an argument (actual_auth_required) and returns a wrapper function (decorated_auth_required).
6871 def actual_auth_required (func ):
6972 """
7073 Authentication required
@@ -94,9 +97,11 @@ def decorated_auth_required(*args, **kwargs):
9497 return func (* args , ** kwargs )
9598 return decorated_auth_required
9699 return actual_auth_required
97-
100+ # https://realpython.com/primer-on-python-decorators/#defining-decorators-with-arguments
98101 @staticmethod
99102 def require_role (role ):
103+ # The function to decorate is only passed in directly if the decorator is called without arguments
104+ # Return a decorator function that takes a function as an argument (actual_auth_required) and returns a wrapper function (decorated_auth_required).
100105 def decorated_require_role (func ):
101106 @wraps (func )
102107 def wrapped_require_role (* args , ** kwargs ):
You can’t perform that action at this time.
0 commit comments