mirror of https://github.com/pallets/flask.git
Updated examples
This commit is contained in:
parent
115d31ddbf
commit
b51ecd7f21
|
@ -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('/')
|
||||
|
|
|
@ -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('/')
|
||||
|
|
Loading…
Reference in New Issue