summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authormarkmcclain <mark.mcclain@dreamhost.com>2013-08-08 16:45:46 -0700
committermarkmcclain <mark.mcclain@dreamhost.com>2013-08-08 16:45:46 -0700
commit7c8bca787ef870f562d6d05a87ca74564d7676ef (patch)
tree41a8a092eda09ee1088dc2341acd7e62f01092e2 /docs
parent7cfc975cf351725354fe51fece2f814fe3defe63 (diff)
parentfb2cf166aaf5b5af461879ec5b7a46806e8aee45 (diff)
downloadpecan-7c8bca787ef870f562d6d05a87ca74564d7676ef.tar.gz
Merge pull request #226 from ryanpetrello/next
Make some notable changes to how ``pecan.conf.app`` is passed to a new app.
Diffstat (limited to 'docs')
-rw-r--r--docs/source/hooks.rst41
1 files changed, 8 insertions, 33 deletions
diff --git a/docs/source/hooks.rst b/docs/source/hooks.rst
index e1c54c4..b7c01ce 100644
--- a/docs/source/hooks.rst
+++ b/docs/source/hooks.rst
@@ -54,17 +54,15 @@ Attaching Hooks
---------------
Hooks can be attached in a project-wide manner by specifying a list of hooks
-in your project's ``app.py`` file.
+in your project's configuration file.
::
- from application.root import RootController
- from my_hooks import SimpleHook
-
- app = make_app(
- RootController(),
- hooks = [SimpleHook()]
- )
+ app = {
+ 'root' : '...'
+ # ...
+ 'hooks': lambda: [SimpleHook()]
+ }
Hooks can also be applied selectively to controllers and their sub-controllers
using the :attr:`__hooks__` attribute on one or more controllers.
@@ -125,20 +123,6 @@ By default, both outputs are enabled.
* :ref:`pecan_hooks`
-Enabling RequestViewerHook
-..........................
-
-This hook can be automatically added to the application itself if a certain
-key, ``requestviewer``, exists in the configuration used for the app, e.g.::
-
- app = {}
- server = {}
- requestviewer = {}
-
-It does not need to contain anything (could be an empty dictionary), and this
-is enough to force Pecan to load this hook when the WSGI application is
-created.
-
Configuring RequestViewerHook
.............................
@@ -179,25 +163,16 @@ response::
X-Pecan-params []
X-Pecan-hooks ['RequestViewerHook']
-The hook can be configured via a dictionary (or Config object from Pecan) when
-adding it to the application or via the ``requestviewer`` key in the actual
-configuration being passed to the application.
-
The configuration dictionary is flexible (none of the keys are required) and
can hold two keys: ``items`` and ``blacklist``.
-This is how the hook would look if configured directly when using ``make_app``
-(shortened for brevity)::
+This is how the hook would look if configured directly (shortened for brevity)::
...
- hooks = [
+ 'hooks': lambda: [
RequestViewerHook({'items':['path']})
]
-And the same configuration could be set in the config file like::
-
- requestviewer = {'items:['path']}
-
Modifying Output Format
.......................