session is saved before @after_request callbacks #351

matejcik opened this Issue Nov 20, 2011 · 0 comments

2 participants


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:

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

def after_request(response):
    session['user'] = g.user and dict(g.user) or None
    return response
@mitsuhiko mitsuhiko closed this in d628df6 Nov 20, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment