summaryrefslogtreecommitdiff
path: root/CHANGES.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CHANGES.txt')
-rw-r--r--CHANGES.txt107
1 files changed, 31 insertions, 76 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index b1979347a..c9c95fd7f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -8,71 +8,28 @@ Features
``rendering_val``. This can be used to introspect the value returned by a
view in a BeforeRender subscriber.
-- New method: ``pyramid.request.Request.add_view_wrapper``. A view wrapper
- is used to wrap the found view callable before it is called by Pyramid's
- router. This is a feature usually only used by framework extensions, to
- provide, for example, view timing support.
-
- A view wrapper factory must be a callable which accepts three arguments:
- ``view_callable``, ``request``, and ``exc``. It must return a view
- callable. The view callable returned by the factory must implement the
- ``context, request`` view callable calling convention. For example::
-
- import time
-
- def wrapper_factory(view_callable, request, exc):
- def wrapper(context, request):
- start = time.time()
- result = view_callable(context, request)
- end = time.time()
- request.view_timing = end - start
- return result
- return wrapper
-
- The ``view_callable`` argument to the factory will be the view callable
- found by Pyramid via view lookup. The ``request`` argument to the factory
- will be the current request. The ``exc`` argument to the factory will be
- an Exception object if the found view is an exception view; it will be
- ``None`` otherwise.
-
- View wrappers only last for the duration of a single request. You can add
- such a factory for every request by using the
- ``pyramid.events.NewRequest`` subscriber::
-
- from pyramid.events import subscriber, NewRequest
-
- @subscriber(NewRequest)
- def newrequest(event):
- event.request.add_view_wrapper(wrapper_factory)
-
- If more than one view wrapper is registered during a single request,
- a 'later' view wrapper factory will be called with the result of its
- directly former view wrapper factory as its ``view_callable``
- argument; this chain will be returned to Pyramid as a single view
- callable.
-
- New configurator directive:
- ``pyramid.config.Configurator.add_request_handler``. This directive adds
- a request handler factory.
+ ``pyramid.config.Configurator.add_request_handler``. This directive adds
+ a request handler factory.
- A request handler factory is used to wrap the Pyramid router's primary
- request handling function. This is a feature usually only used by
- framework extensions, to provide, for example, view timing support and as
- a convenient place to hang bookkeeping code that examines exceptions
- before they are returned to the server.
+ A request handler factory is used to wrap the Pyramid router's primary
+ request handling function. This is a feature may be used by framework
+ extensions, to provide, for example, view timing support and as a
+ convenient place to hang bookkeeping code that examines exceptions before
+ they are returned to the server.
- A request handler factory (passed as ``handler_factory``) must be a
- callable which accepts two arguments: ``handler`` and ``registry``.
- ``handler`` will be the request handler being wrapped. ``registry`` will
- be the Pyramid application registry represented by this Configurator. A
- request handler factory must return a request handler when it is called.
+ A request handler factory (passed as ``handler_factory``) must be a
+ callable which accepts two arguments: ``handler`` and ``registry``.
+ ``handler`` will be the request handler being wrapped. ``registry`` will
+ be the Pyramid application registry represented by this Configurator. A
+ request handler factory must return a request handler when it is called.
- A request handler accepts a request object and returns a response object.
+ A request handler accepts a request object and returns a response object.
- Here's an example of creating both a handler factory and a handler, and
- registering the handler factory:
+ Here's an example of creating both a handler factory and a handler, and
+ registering the handler factory:
- .. code-block:: python
+ .. code-block:: python
import time
@@ -93,23 +50,21 @@ Features
config.add_request_handler(timing_handler_factory, 'timing')
- The ``request`` argument to the handler will be the request created by
- Pyramid's router when it receives a WSGI request.
-
- If more than one request handler factory is registered into a single
- configuration, the request handlers will be chained together. The first
- request handler factory added (in code execution order) will be called
- with the default Pyramid request handler, the second handler factory added
- will be called with the result of the first handler factory, ad
- infinitum. The Pyramid router will use the outermost wrapper in this chain
- (which is a bit like a WSGI middleware "pipeline") as its handler
- function.
-
- The ``name`` argument to this function is required. The name is used as a
- key for conflict detection. No two request handler factories may share
- the same name in the same configuration (unless
- automatic_conflict_resolution is able to resolve the conflict or
- this is an autocommitting configurator).
+ The ``request`` argument to the handler will be the request created by
+ Pyramid's router when it receives a WSGI request.
+
+ If more than one request handler factory is registered into a single
+ configuration, the request handlers will be chained together. The first
+ request handler factory added (in code execution order) will be called with
+ the default Pyramid request handler, the second handler factory added will
+ be called with the result of the first handler factory, ad infinitum. The
+ Pyramid router will use the outermost wrapper in this chain (which is a bit
+ like a WSGI middleware "pipeline") as its handler function.
+
+ The ``name`` argument to this function is required. The name is used as a
+ key for conflict detection. No two request handler factories may share the
+ same name in the same configuration (unless automatic_conflict_resolution
+ is able to resolve the conflict or this is an autocommitting configurator).
1.1 (2011-07-22)
================