diff options
| author | Chris McDonough <chrism@agendaless.com> | 2008-08-04 07:38:58 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2008-08-04 07:38:58 +0000 |
| commit | e17c8d815136218d7dd07e21cf78f4104d773d48 (patch) | |
| tree | 5ad65808c9f0e7828e4ec1b2c948726cffe953a6 /docs/api/events.rst | |
| parent | 39b8b920c8018dc4d124cba72794da1dcc925cce (diff) | |
| download | pyramid-e17c8d815136218d7dd07e21cf78f4104d773d48.tar.gz pyramid-e17c8d815136218d7dd07e21cf78f4104d773d48.tar.bz2 pyramid-e17c8d815136218d7dd07e21cf78f4104d773d48.zip | |
- Add a ``request_type`` attribute to the available attributes of a
``bfg:view`` configure.zcml element. This attribute will have a
value which is a dotted Python path, pointing at an interface. If
the request object implements this interface when the view lookup
is performed, the appropriate view will be called.
- Remove "template only" views. These were just confusing and were
never documented.
Diffstat (limited to 'docs/api/events.rst')
| -rw-r--r-- | docs/api/events.rst | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/docs/api/events.rst b/docs/api/events.rst index 25bb9841b..b2cd4a100 100644 --- a/docs/api/events.rst +++ b/docs/api/events.rst @@ -9,41 +9,6 @@ .. autoclass:: NewResponse -You can write *listeners* for these event types and subsequently -register the listeners to be called when the events occur. For -example, if you create event listener functions in a ``listeners.py`` -file in your application like so: - -.. code-block:: python - :linenos: - - def handle_new_request(event): - print 'request', event.request - - def handle_new_response(event): - print 'response', event.response - -You may configure these functions to be called at the appropriate -times by adding the following to your application's ``configure.zcml`` -file: - -.. code-block:: xml - :linenos: - - <subscriber - for="repoze.bfg.interfaces.INewRequest" - handler=".listeners.handle_new_request" - /> - - <subscriber - for="repoze.bfg.interfaces.INewResponse" - handler=".listeners.handle_new_response" - /> - -This causes the functions as to be registered as event listeners -within the :term:`application registry` . Under this configuration, -when the application is run, every new request and every response will -be printed to the console. - -The return value of a listener function is ignored. +See :ref:`events_chapter` for more information about how to register +code which subscribes to these events. |
