summaryrefslogtreecommitdiff
path: root/docs/api
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2010-11-02 02:32:02 -0400
committerChris McDonough <chrism@plope.com>2010-11-02 02:32:02 -0400
commita76e99959ecc3220c317cb2942332a9fc342f3a4 (patch)
treecc421c38084090d522f6d411aa8afc8df57c4617 /docs/api
parent809744e041f845ca7bd6586fb882e9bb01e03182 (diff)
downloadpyramid-a76e99959ecc3220c317cb2942332a9fc342f3a4.tar.gz
pyramid-a76e99959ecc3220c317cb2942332a9fc342f3a4.tar.bz2
pyramid-a76e99959ecc3220c317cb2942332a9fc342f3a4.zip
- New event type: ``pyramid.interfaces.IBeforeRender``. An object of this type
is sent as an event before a renderer is invoked (but after the application-level renderer globals factory added via ``pyramid.configurator.configuration.set_renderer_globals_factory``, if any, has injected its own keys). Applications may now subscribe to the ``IBeforeRender`` event type in order to introspect the and modify the set of renderer globals before they are passed to a renderer. The event object iself has a dictionary-like interface that can be used for this purpose. For example:: from repoze.events import subscriber from pyramid.interfaces import IRendererGlobalsEvent @subscriber(IRendererGlobalsEvent) def add_global(event): event['mykey'] = 'foo' If a subscriber attempts to add a key that already exist in the renderer globals dictionary, a ``KeyError`` is raised. This limitation is due to the fact that subscribers cannot be ordered relative to each other. The set of keys added to the renderer globals dictionary by all subscribers and app-level globals factories must be unique.
Diffstat (limited to 'docs/api')
-rw-r--r--docs/api/events.rst3
-rw-r--r--docs/api/interfaces.rst2
2 files changed, 5 insertions, 0 deletions
diff --git a/docs/api/events.rst b/docs/api/events.rst
index 8371ba61d..59657a820 100644
--- a/docs/api/events.rst
+++ b/docs/api/events.rst
@@ -23,6 +23,9 @@ Event Types
.. autoclass:: NewResponse
+.. autoclass:: BeforeRender
+ :members:
+
See :ref:`events_chapter` for more information about how to register
code which subscribes to these events.
diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst
index db610308d..b27428d89 100644
--- a/docs/api/interfaces.rst
+++ b/docs/api/interfaces.rst
@@ -16,6 +16,8 @@ Event-Related Interfaces
.. autointerface:: INewResponse
+ .. autointerface:: IBeforeRender
+
Other Interfaces
++++++++++++++++