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:
parent
8d7ca29a35
commit
8445f0d939
1 changed files with 3 additions and 1 deletions
|
|
@ -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=[]):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue