summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-07-02 17:00:09 -0400
committerChris McDonough <chrism@plope.com>2011-07-02 17:00:09 -0400
commitac7a9aac93392ca035a983b138df4848b6a333b6 (patch)
treeda027ee2128ae37d1b13eda5c6911ce058070430 /docs
parente21ed88a6dccc1b6f7fee825c6e7afa6d22bd51e (diff)
downloadpyramid-ac7a9aac93392ca035a983b138df4848b6a333b6.tar.gz
pyramid-ac7a9aac93392ca035a983b138df4848b6a333b6.tar.bz2
pyramid-ac7a9aac93392ca035a983b138df4848b6a333b6.zip
reorder
Diffstat (limited to 'docs')
-rw-r--r--docs/narr/hooks.rst86
1 files changed, 44 insertions, 42 deletions
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst
index 56c566a4c..94701c9f9 100644
--- a/docs/narr/hooks.rst
+++ b/docs/narr/hooks.rst
@@ -176,12 +176,54 @@ already constructed a :term:`configurator` it can also be registered via the
config.set_request_factory(MyRequest)
.. index::
+ single: before render event
+ single: adding renderer globals
+
+.. _beforerender_event:
+
+Using The Before Render Event
+-----------------------------
+
+Subscribers to the :class:`pyramid.events.BeforeRender` 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:
+
+.. code-block:: python
+ :linenos:
+
+ from pyramid.events import subscriber
+ from pyramid.events import BeforeRender
+
+ @subscriber(BeforeRender)
+ def add_global(event):
+ event['mykey'] = 'foo'
+
+An object of this type is sent as an event just before a :term:`renderer` is
+invoked (but *after* the application-level renderer globals factory added via
+:class:`~pyramid.config.Configurator.set_renderer_globals_factory`, if any,
+has injected its own keys into the renderer globals dictionary).
+
+If a subscriber attempts to add a key that already exist in the renderer
+globals dictionary, a :exc:`KeyError` is raised. This limitation is enforced
+because event subscribers do not possess any relative ordering. The set of
+keys added to the renderer globals dictionary by all
+:class:`pyramid.events.BeforeRender` subscribers and renderer globals
+factories must be unique.
+
+See the API documentation for the :class:`~pyramid.events.BeforeRender` event
+interface at :class:`pyramid.interfaces.IBeforeRender`.
+
+Another (deprecated) mechanism which allows event subscribers more control
+when adding renderer global values exists in :ref:`adding_renderer_globals`.
+
+.. index::
single: renderer globals
.. _adding_renderer_globals:
-Adding Renderer Globals
------------------------
+Adding Renderer Globals (Deprecated)
+------------------------------------
.. warning:: this feature is deprecated as of Pyramid 1.1. A non-deprecated
mechanism which allows event subscribers to add renderer global values
@@ -231,46 +273,6 @@ already constructed a :term:`configurator` it can also be registered via the
config = Configurator()
config.set_renderer_globals_factory(renderer_globals_factory)
-.. index::
- single: before render event
-
-.. _beforerender_event:
-
-Using The Before Render Event
------------------------------
-
-Subscribers to the :class:`pyramid.events.BeforeRender` 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:
-
-.. code-block:: python
- :linenos:
-
- from pyramid.events import subscriber
- from pyramid.events import BeforeRender
-
- @subscriber(BeforeRender)
- def add_global(event):
- event['mykey'] = 'foo'
-
-An object of this type is sent as an event just before a :term:`renderer` is
-invoked (but *after* the application-level renderer globals factory added via
-:class:`~pyramid.config.Configurator.set_renderer_globals_factory`, if any,
-has injected its own keys into the renderer globals dictionary).
-
-If a subscriber attempts to add a key that already exist in the renderer
-globals dictionary, a :exc:`KeyError` is raised. This limitation is enforced
-because event subscribers do not possess any relative ordering. The set of
-keys added to the renderer globals dictionary by all
-:class:`pyramid.events.BeforeRender` subscribers and renderer globals
-factories must be unique.
-
-See the API documentation for the :class:`~pyramid.events.BeforeRender` event
-interface at :class:`pyramid.interfaces.IBeforeRender`.
-
-Another mechanism which allows event subscribers more control when adding
-renderer global values exists in :ref:`adding_renderer_globals`.
.. index::
single: response callback