Browse Source

Prevent pop if flashes not in session to avoid modification to session fixes #227

pull/232/head
Sharoon Thomas 14 years ago
parent
commit
57920a5808
  1. 3
      flask/helpers.py

3
flask/helpers.py

@ -249,7 +249,8 @@ def get_flashed_messages(with_categories=False):
"""
flashes = _request_ctx_stack.top.flashes
if flashes is None:
_request_ctx_stack.top.flashes = flashes = session.pop('_flashes', [])
_request_ctx_stack.top.flashes = flashes = session.pop('_flashes') \
if '_flashes' in session else []
if not with_categories:
return [x[1] for x in flashes]
return flashes

Loading…
Cancel
Save