log req 装饰器

  1. from functools import wraps
  2. def login_required(function):
  3. @wraps(function)
  4. def decorated_function(*args, **kwargs):
  5. ...
  6. # authorize here
  7. ...
  8. if {passed}:
  9. return function(*args, **kwargs)
  10. return {something else}
  11. return decorated_function