pyramid: make flash messages not rely strictly on pylons session.
- now if we pass in request it relies to bound session store of given request.
This commit is contained in:
parent
81027a10de
commit
69e1f8e453
1 changed files with 6 additions and 3 deletions
|
|
@ -660,15 +660,18 @@ class _Message(object):
|
|||
|
||||
class Flash(_Flash):
|
||||
|
||||
def pop_messages(self):
|
||||
def pop_messages(self, request=None):
|
||||
"""Return all accumulated messages and delete them from the session.
|
||||
|
||||
The return value is a list of ``Message`` objects.
|
||||
"""
|
||||
from pylons import session
|
||||
|
||||
messages = []
|
||||
|
||||
if request:
|
||||
session = request.session
|
||||
else:
|
||||
from pylons import session
|
||||
|
||||
# Pop the 'old' pylons flash messages. They are tuples of the form
|
||||
# (category, message)
|
||||
for cat, msg in session.pop(self.session_key, []):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue