diff options
| author | Chris McDonough <chrism@plope.com> | 2011-11-12 18:19:10 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-11-12 18:19:10 -0500 |
| commit | 8958c3b8d28e2d9f690ddd01cd80b7c4187b07c9 (patch) | |
| tree | 1f9b1cf325e4a938fd0aa274752e1630a5e0f1ad | |
| parent | 4b4ef7befce479bde5caffb823cc028312cd833e (diff) | |
| parent | b91ca3229be367f58f6dbf24525e640c6a4f7c1d (diff) | |
| download | pyramid-8958c3b8d28e2d9f690ddd01cd80b7c4187b07c9.tar.gz pyramid-8958c3b8d28e2d9f690ddd01cd80b7c4187b07c9.tar.bz2 pyramid-8958c3b8d28e2d9f690ddd01cd80b7c4187b07c9.zip | |
Merge branch 'master' of github.com:Pylons/pyramid
| -rw-r--r-- | pyramid/events.py | 24 | ||||
| -rw-r--r-- | pyramid/interfaces.py | 2 |
2 files changed, 14 insertions, 12 deletions
diff --git a/pyramid/events.py b/pyramid/events.py index 5ef60ea89..4a2cd6240 100644 --- a/pyramid/events.py +++ b/pyramid/events.py @@ -167,7 +167,7 @@ WSGIApplicationCreatedEvent = ApplicationCreated # b/c (as of 1.0) @implementer(IBeforeRender) class BeforeRender(dict): """ - Subscribers to this event may introspect the and modify the set of + Subscribers to this event may introspect and modify the set of :term:`renderer globals` before they are passed to a :term:`renderer`. This event object iself has a dictionary-like interface that can be used for this purpose. For example:: @@ -185,20 +185,22 @@ class BeforeRender(dict): :class:`pyramid.config.Configurator.set_renderer_globals_factory`, if any, has injected its own keys into the renderer globals dictionary). - If a subscriber adds a key via ``__setitem__`` or that already exists in - the renderer globals dictionary, it will overwrite an older value that is - already in the globals dictionary. This can be problematic because event - subscribers to the BeforeRender event do not possess any relative - ordering. For maximum interoperability with other third-party - subscribers, if you write an event subscriber meant to be used as a - BeforeRender subscriber, your subscriber code will need to (using - ``.get`` or ``__contains__`` of the event object) ensure no value already - exists in the renderer globals dictionary before setting an overriding - value. + If a subscriber adds a key via ``__setitem__`` that already exists in + the renderer globals dictionary, it will overwrite the older value there. + This can be problematic because event subscribers to the BeforeRender + event do not possess any relative ordering. For maximum interoperability + with other third-party subscribers, if you write an event subscriber meant + to be used as a BeforeRender subscriber, your subscriber code will need to + ensure no value already exists in the renderer globals dictionary before + setting an overriding value (which can be done using ``.get`` or + ``__contains__`` of the event object). The event has an additional attribute named ``rendering_val``. This is the (non-system) value returned by a view or passed to ``render*`` as ``value``. This feature is new in Pyramid 1.2. + + For a description of the values present in the renderer globals dictionary, + see :ref:`renderer_system_values`. See also :class:`pyramid.interfaces.IBeforeRender`. """ diff --git a/pyramid/interfaces.py b/pyramid/interfaces.py index f08bd5fbb..fcdf72d01 100644 --- a/pyramid/interfaces.py +++ b/pyramid/interfaces.py @@ -344,7 +344,7 @@ class IDict(Interface): class IBeforeRender(IDict): """ - Subscribers to this event may introspect the and modify the set of + Subscribers to this event may introspect and modify the set of :term:`renderer globals` before they are passed to a :term:`renderer`. The event object itself provides a dictionary-like interface for adding and removing :term:`renderer globals`. The keys and values of the |
