summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2012-03-02 13:49:39 -0500
committerChris McDonough <chrism@plope.com>2012-03-02 13:49:39 -0500
commit3c010407522397e2448f43be5ba02841012a66b9 (patch)
treeb89365f37ea58d66afc35d103c72993e9ecf830d /docs
parent56734324a8550a706320aa784e8435f1cfaf9b50 (diff)
parent1757f08f32e4708156b494d9b4411bd19f18a01e (diff)
downloadpyramid-3c010407522397e2448f43be5ba02841012a66b9.tar.gz
pyramid-3c010407522397e2448f43be5ba02841012a66b9.tar.bz2
pyramid-3c010407522397e2448f43be5ba02841012a66b9.zip
Merge branch '1.3-branch'
Diffstat (limited to 'docs')
-rw-r--r--docs/narr/hooks.rst21
1 files changed, 7 insertions, 14 deletions
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst
index f1a122c6c..24ea5de21 100644
--- a/docs/narr/hooks.rst
+++ b/docs/narr/hooks.rst
@@ -421,15 +421,14 @@ parameter: ``request``. For example:
.. code-block:: python
:linenos:
- import transaction
+ import logging
- def commit_callback(request):
- '''commit or abort the transaction associated with request'''
- if request.exception is not None:
- transaction.abort()
- else:
- transaction.commit()
- request.add_finished_callback(commit_callback)
+ log = logging.getLogger(__name__)
+
+ def log_callback(request):
+ """Log information at the end of request"""
+ log.debug('Request is finished.')
+ request.add_finished_callback(log_callback)
Finished callbacks are called in the order they're added
(first-to-most-recently-added). Finished callbacks (unlike a
@@ -447,12 +446,6 @@ meaningful effect, because response processing will have already occurred,
and the request's scope will expire almost immediately after all finished
callbacks have been processed.
-It is often necessary to tell whether an exception occurred within
-:term:`view callable` code from within a finished callback: in such a case,
-the :attr:`request.exception` attribute of the request when it enters a
-response callback will be an exception object instead of its default value of
-``None``.
-
Errors raised by finished callbacks are not handled specially. They
will be propagated to the caller of the :app:`Pyramid` router
application.