Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed assumption made on session implementations.

In the snippet 'session.setdefault(...).append(...)', it was being
assumed that changes made to mutable structures in the session are
are always in sync with the session object, which is not true for
session implementations that use a external storage for keeping their
keys/values.
  • Loading branch information...
commit 8445f0d939dc3c4a2e722dc6dd4938d02bc2e094 1 parent 8d7ca29
@tarruda tarruda authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 flask/helpers.py
View
4 flask/helpers.py
@@ -261,7 +261,9 @@ def flash(message, category='message'):
messages and ``'warning'`` for warnings. However any
kind of string can be used as category.
"""
- session.setdefault('_flashes', []).append((category, message))
+ flashes = session.get('_flashes', [])
+ flashes.append((category, message))
+ session['_flashes'] = flashes
def get_flashed_messages(with_categories=False, category_filter=[]):
Please sign in to comment.
Something went wrong with that request. Please try again.