forked from orbit-oss/flask
Updated the docs and examples to non-failing teardown handlers
This commit is contained in:
parent
485a6c332b
commit
d3ca55177a
5 changed files with 24 additions and 5 deletions
|
|
@ -142,7 +142,8 @@ You are now encouraged to use this instead::
|
|||
|
||||
@app.teardown_request
|
||||
def after_request(exception):
|
||||
g.db.close()
|
||||
if hasattr(g, 'db'):
|
||||
g.db.close()
|
||||
|
||||
On the upside this change greatly improves the internal code flow and
|
||||
makes it easier to customize the dispatching and error handling. This
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue