diff options
| author | Chris McDonough <chrism@agendaless.com> | 2008-11-16 00:15:18 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2008-11-16 00:15:18 +0000 |
| commit | 60bfb44d6b8e17c750406c884848c0f7b38181d5 (patch) | |
| tree | 668979a939949b7fa31c2f18d7cb3df8135afeb8 /docs/narr/events.rst | |
| parent | 5cd6bd90369d5937a6571a70bff4d59551ec9325 (diff) | |
| download | pyramid-60bfb44d6b8e17c750406c884848c0f7b38181d5.tar.gz pyramid-60bfb44d6b8e17c750406c884848c0f7b38181d5.tar.bz2 pyramid-60bfb44d6b8e17c750406c884848c0f7b38181d5.zip | |
Describe registration.
Diffstat (limited to 'docs/narr/events.rst')
| -rw-r--r-- | docs/narr/events.rst | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/docs/narr/events.rst b/docs/narr/events.rst index 6bdbb59f4..c6242c25d 100644 --- a/docs/narr/events.rst +++ b/docs/narr/events.rst @@ -134,23 +134,30 @@ object provided by the event. Here's an example. if 'application/json' in accept: alsoProvides(request, IJSONRequest) -Then in your view registration ZCML, you can use the ``request_type`` -attribute to point at different view functions depending upon the -interface implemented by the request. For example, if the above -subscriber function was registered, the three view registrations below -could be used to point at separate view functions using separate -request type interfaces for the same model object. +Then in your view registration ZCML, if you subscribe +``categorize_request`` for the ``repoze.bfg.interfaces.INewRequest`` +type, you can use the ``request_type`` attribute to point at different +view functions depending upon the interface implemented by the +request. For example, if the above subscriber function was +registered, the three view registrations below could be used to point +at separate view functions using separate request type interfaces for +the same model object. .. code-block:: xml :linenos: - <!-- html view --> + <subscriber + for="repoze.bfg.interfaces.INewRequest" + handler=".subscribers.categorize_request" + /> + + <!-- html default view --> <bfg:view for=".models.MyModel" request_type="repoze.bfg.interfaces.IRequest" view=".views.html_view"/> - <!-- JSON view --> + <!-- JSON default view --> <bfg:view for=".models.MyModel" request_type=".interfaces.IJSONRequest" |
