From 844e98b01c5c6aa1585a76ac77f92bb8c1ef9d90 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 5 Sep 2010 04:58:23 +0000 Subject: Documentation ------------- - Add an API chapter for the ``repoze.bfg.request`` module, which includes documentation for the ``repoze.bfg.request.Request`` class (the "request object"). - Modify the "Request and Response" narrative chapter to reference the new ``repoze.bfg.request`` API chapter. Some content was moved from this chapter into the API documentation itself. Features -------- - A new ``repoze.bfg.request.Request.add_response_callback`` API has been added. This method is documented in the new ``repoze.bfg.request`` API chapter. It can be used to influence response values before a concrete response object has been created. Internal -------- - The (internal) feature which made it possible to attach a ``global_response_headers`` attribute to the request (which was assumed to contain a sequence of header key/value pairs which would later be added to the response by the router), has been removed. The functionality of ``repoze.bfg.request.Request.add_response_callback`` takes its place. --- repoze/bfg/testing.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'repoze/bfg/testing.py') diff --git a/repoze/bfg/testing.py b/repoze/bfg/testing.py index d5ae7bd56..5502cb3d2 100644 --- a/repoze/bfg/testing.py +++ b/repoze/bfg/testing.py @@ -568,6 +568,7 @@ class DummyRequest(object): application_url = 'http://example.com' host = 'example.com:80' content_length = 0 + response_callbacks = () def __init__(self, params=None, environ=None, headers=None, path='/', cookies=None, post=None, **kw): if environ is None: @@ -608,6 +609,11 @@ class DummyRequest(object): self.registry = get_current_registry() self.__dict__.update(kw) + def add_response_callback(self, callback): + if not self.response_callbacks: + self.response_callbacks = [] + self.response_callbacks.append(callback) + def setUp(registry=None, request=None, hook_zca=True): """ Set :mod:`repoze.bfg` registry and request thread locals for the -- cgit v1.2.3