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.
This commit is contained in:
Thiago de Arruda 2012-03-02 07:46:39 -03:00
parent 8d7ca29a35
commit 8445f0d939

View file

@ -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=[]):