Browse Source

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.
pull/417/head
Thiago de Arruda 13 years ago
parent
commit
8445f0d939
  1. 4
      flask/helpers.py

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

Loading…
Cancel
Save