mitsuhiko/flask — Issue #351: session is saved before @after_request callbacks
Author: matejcik
Created: 2011-11-20 00:23:00+00:00
State: open

This makes it impossible to add data to session in said callbacks. For example, the following code does not work, because session is never stored:

```python
@app.before_request
def before_request():
u = session.get('user')
g.user = u and db.User(u) or None

@app.after_request
def after_request(response):
session['user'] = g.user and dict(g.user) or None
return response
```