Browse Source

Allow positional arguments to @login_required decorator in examples/tutorial/flaskr/auth.py

pull/2942/head
Alessandro Bruni 6 years ago
parent
commit
c64a0c74e3
  1. 4
      examples/tutorial/flaskr/auth.py

4
examples/tutorial/flaskr/auth.py

@ -13,11 +13,11 @@ bp = Blueprint('auth', __name__, url_prefix='/auth')
def login_required(view):
"""View decorator that redirects anonymous users to the login page."""
@functools.wraps(view)
def wrapped_view(**kwargs):
def wrapped_view(*args, **kwargs):
if g.user is None:
return redirect(url_for('auth.login'))
return view(**kwargs)
return view(*args, **kwargs)
return wrapped_view

Loading…
Cancel
Save