diff options
| -rw-r--r-- | docs/narr/hooks.rst | 7 | ||||
| -rw-r--r-- | pyramid/router.py | 4 | ||||
| -rw-r--r-- | pyramid/tweens.py | 4 |
3 files changed, 7 insertions, 8 deletions
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst index 7290876e6..c6438dfdf 100644 --- a/docs/narr/hooks.rst +++ b/docs/narr/hooks.rst @@ -855,8 +855,7 @@ will be the Pyramid :term:`application registry` represented by this Configurator. A tween factory must return a tween when it is called. A tween is a callable which accepts a :term:`request` object and returns a -two-tuple consisting of a :term:`request` object and a :term:`response` -object. +two-tuple a :term:`response` object. Once you've created a tween factory, you can register it using the :meth:`pyramid.config.Configurator.add_tween` method. @@ -878,12 +877,12 @@ Here's an example creating a tween factory and registering it: def timing_tween(request): start = time.time() try: - request, response = handler(request) + response = handler(request) finally: end = time.time() log.debug('The request took %s seconds' % (end - start)) - return request, response + return response return timing_tween # if timing support is not enabled, return the original # handler diff --git a/pyramid/router.py b/pyramid/router.py index 5faafb4bb..79fd7992b 100644 --- a/pyramid/router.py +++ b/pyramid/router.py @@ -162,7 +162,7 @@ class Router(object): if request.response_callbacks: request._process_response_callbacks(response) - return request, response + return response finally: if request is not None and request.finished_callbacks: @@ -183,7 +183,7 @@ class Router(object): manager.push(threadlocals) try: request.registry = registry - request, response = self.handle_request(request) + response = self.handle_request(request) return response(request.environ, start_response) finally: manager.pop() diff --git a/pyramid/tweens.py b/pyramid/tweens.py index 209768198..f7673a738 100644 --- a/pyramid/tweens.py +++ b/pyramid/tweens.py @@ -17,7 +17,7 @@ def excview_tween_factory(handler, registry): def excview_tween(request): attrs = request.__dict__ try: - request, response = handler(request) + response = handler(request) except Exception, exc: # WARNING: do not assign the result of sys.exc_info() to a # local var here, doing so will cause a leak @@ -39,7 +39,7 @@ def excview_tween_factory(handler, registry): finally: attrs['exc_info'] = None - return request, response + return response return excview_tween |
