User not authenticated search fix

When a user is not logged in and attempts to access the login page with debug mode enabled, the file "base.html" throws an exception claiming that "search_form" is not an attribute of the global "g" object. It appears this was being caused by "search_form" only being defined for "g" if the user is authenticated. Moved attribute declaration out of if clause.
This commit is contained in:
FFX01 2015-07-16 00:07:49 -07:00
parent 5e9cc831e8
commit cef96c6e67
1 changed files with 1 additions and 1 deletions

View File

@ -28,11 +28,11 @@ def get_locale():
@app.before_request @app.before_request
def before_request(): def before_request():
g.user = current_user g.user = current_user
g.search_form = SearchForm()
if g.user.is_authenticated(): if g.user.is_authenticated():
g.user.last_seen = datetime.utcnow() g.user.last_seen = datetime.utcnow()
db.session.add(g.user) db.session.add(g.user)
db.session.commit() db.session.commit()
g.search_form = SearchForm()
g.locale = get_locale() g.locale = get_locale()