Modernized docs in a few places
This commit is contained in:
parent
e2d4aa1207
commit
29bda590b2
3 changed files with 29 additions and 18 deletions
|
|
@ -18,7 +18,9 @@ decorators::
|
|||
|
||||
@app.teardown_request
|
||||
def teardown_request(exception):
|
||||
g.db.close()
|
||||
db = getattr(g, 'db', None)
|
||||
if db is not None:
|
||||
db.close()
|
||||
|
||||
Functions marked with :meth:`~flask.Flask.before_request` are called before
|
||||
a request and passed no arguments. Functions marked with
|
||||
|
|
@ -38,6 +40,9 @@ things on other objects because this would not work with threaded
|
|||
environments. That special :data:`~flask.g` object does some magic behind
|
||||
the scenes to ensure it does the right thing.
|
||||
|
||||
For an even better way to handle such resources see the :ref:`slite3`
|
||||
documentation.
|
||||
|
||||
Continue to :ref:`tutorial-views`.
|
||||
|
||||
.. hint:: Where do I put this code?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue