I have a flask app, where i have implemented a snippet, to check if a user is logged in, in order to acces certain webpages on my application.
My method looks like this:
#check if session is avaliable to access hidden pages for non users
def is_logged_in(f):
@wraps(f)
def wrap(*args, **kwargs):
if 'logged_in' in session:
return f(*args, **kwargs)
else:
flash('Please Login ', 'danger')
return redirect(url_for('login'))
return wrap
Here I check if the session has a logged_in
attribute attached the the session.
However, I get an error saying global name @wraps is not defined
,
but I have no idea as to why?