Skip to content

Commit b51ecd7

Browse files
committed
Updated examples
1 parent 115d31d commit b51ecd7

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

examples/flaskr/flaskr.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,10 @@ def before_request():
4747
g.db = connect_db()
4848

4949

50-
@app.after_request
51-
def after_request(response):
50+
@app.teardown_request
51+
def teardown_request(exception):
5252
"""Closes the database again at the end of the request."""
5353
g.db.close()
54-
return response
5554

5655

5756
@app.route('/')

examples/minitwit/minitwit.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,10 @@ def before_request():
8282
[session['user_id']], one=True)
8383

8484

85-
@app.after_request
86-
def after_request(response):
85+
@app.teardown_request
86+
def teardown_request(exception):
8787
"""Closes the database again at the end of the request."""
8888
g.db.close()
89-
return response
9089

9190

9291
@app.route('/')

0 commit comments

Comments
 (0)