Skip to content
Myr

Fixed assumption made on session implementations.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

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.

authored by Thiago de Arruda · committed by Thiago de Arruda · parent 8d7ca29 · Browse files · 1 file+3 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−1 removed

  • other:+3 added−1 removed

1 file+3 added−1 removed

modified:flask/helpers.py+3 added-1 removed
259 unmodified lines
260 ``'error'`` for errors, ``'info'`` for information261 messages and ``'warning'`` for warnings. However any262 kind of string can be used as category.263 """264 session.setdefault('_flashes', []).append((category, message))264 flashes = session.get('_flashes', [])265 flashes.append((category, message))266 session['_flashes'] = flashes267268269def get_flashed_messages(with_categories=False, category_filter=[]):270 """Pulls all flashed messages from the session and returns them.
420 unmodified lines