Merge pull request #557 from hpincket/patch-1

docs(tutorial): note depreciation of global hooks
This commit is contained in:
Kurt Griffiths
2015-07-13 23:26:31 -05:00

View File

@@ -548,8 +548,7 @@ responders in a DRY way, e.g.,:
params['project_id'] = req.get_header('X-PROJECT-ID')
Now, you can imagine that such a hook should apply to all responders for
a resource, or even globally to all resources. You can apply hooks to an
entire resource like so:
a resource. You can apply hooks to an entire resource like so:
.. code:: python
@@ -558,12 +557,8 @@ entire resource like so:
# ...
And you can apply hooks globally by passing them into the API class
initializer:
.. code:: python
falcon.API(before=[extract_project_id])
Similar logic can be applied globally with middleware.
(See :ref:`falcon.middleware <middleware>`)
To learn more about hooks, take a look at the docstring for the ``API`` class,
as well the docstrings for the ``falcon.before`` and ``falcon.after`` decorators.