Updated examples

This commit is contained in:
Armin Ronacher 2011-05-27 20:29:47 +02:00
parent 115d31ddbf
commit b51ecd7f21
2 changed files with 4 additions and 6 deletions

View File

@ -47,11 +47,10 @@ def before_request():
g.db = connect_db()
@app.after_request
def after_request(response):
@app.teardown_request
def teardown_request(exception):
"""Closes the database again at the end of the request."""
g.db.close()
return response
@app.route('/')

View File

@ -82,11 +82,10 @@ def before_request():
[session['user_id']], one=True)
@app.after_request
def after_request(response):
@app.teardown_request
def teardown_request(exception):
"""Closes the database again at the end of the request."""
g.db.close()
return response
@app.route('/')