From b51ecd7f212588b3d7363db90a4ab8318ec2fa80 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Fri, 27 May 2011 20:29:47 +0200 Subject: [PATCH] Updated examples --- examples/flaskr/flaskr.py | 5 ++--- examples/minitwit/minitwit.py | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/flaskr/flaskr.py b/examples/flaskr/flaskr.py index 69953555..361c1aee 100644 --- a/examples/flaskr/flaskr.py +++ b/examples/flaskr/flaskr.py @@ -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('/') diff --git a/examples/minitwit/minitwit.py b/examples/minitwit/minitwit.py index 7726e9f4..f7c700d3 100644 --- a/examples/minitwit/minitwit.py +++ b/examples/minitwit/minitwit.py @@ -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('/')