From 4382771853363858629fe851581814089ca9350d Mon Sep 17 00:00:00 2001 From: Carlos de la Guardia Date: Fri, 11 Nov 2011 21:43:33 -0600 Subject: Fix some typos and restructure text a bit --- pyramid/events.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/pyramid/events.py b/pyramid/events.py index 5ef60ea89..b86aa871a 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,16 +185,15 @@ 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 -- cgit v1.2.3 From 7709b1e047e88bf8c6b5f9b35bc589914023929d Mon Sep 17 00:00:00 2001 From: Carlos de la Guardia Date: Fri, 11 Nov 2011 21:53:28 -0600 Subject: typo --- pyramid/interfaces.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.3 From b91ca3229be367f58f6dbf24525e640c6a4f7c1d Mon Sep 17 00:00:00 2001 From: Carlos de la Guardia Date: Fri, 11 Nov 2011 22:02:44 -0600 Subject: Add link to renderer dict globals from BeforeRender event (#351) --- pyramid/events.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyramid/events.py b/pyramid/events.py index b86aa871a..4a2cd6240 100644 --- a/pyramid/events.py +++ b/pyramid/events.py @@ -198,6 +198,9 @@ class BeforeRender(dict): 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`. """ -- cgit v1.2.3