Ticket #4604: __init__.py

File __init__.py, 327 bytes (added by Sean Patrick Hogan <sp.hogan@…>, 17 years ago)

FlashMiddleware and flash context processor

Line 
1class FlashMiddleware:
2 def process_response(self, request, response):
3 try:
4 request.session['flash'] = request.flash
5 except:
6 pass
7 return response
8
9def flash(request):
10 if 'flash' in request.session:
11 flash = request.session['flash']
12 del request.session['flash']
13 return {'flash': flash}
14 return {'flash': None}
Back to Top