Browse Source

Updated examples

pull/262/head
Armin Ronacher 14 years ago
parent
commit
b51ecd7f21
  1. 5
      examples/flaskr/flaskr.py
  2. 5
      examples/minitwit/minitwit.py

5
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('/')

5
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('/')

Loading…
Cancel
Save