Modernized docs in a few places

This commit is contained in:
Armin Ronacher 2013-06-09 12:30:27 +01:00
parent e2d4aa1207
commit 29bda590b2
3 changed files with 29 additions and 18 deletions

View file

@ -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?