From 4a4ebf30597c01699663e40f83b406a6747d2b41 Mon Sep 17 00:00:00 2001 From: ianb Date: Thu, 3 Nov 2005 04:08:18 +0000 Subject: Added hook for frameworks to add custom variables to the response object --- docs/testing-applications.txt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/testing-applications.txt b/docs/testing-applications.txt index c583225..8e64c52 100644 --- a/docs/testing-applications.txt +++ b/docs/testing-applications.txt @@ -128,4 +128,21 @@ Request objects: ``full_url``: The url with query string. - +Framework Hooks +=============== + +Frameworks can detect that they are in a testing environment by the +presence (and truth) of the WSGI environmental variable +``"paste.testing"`` (which will be true). + +More generally, frameworks can detect that something (possibly a test +fixture) is ready to catch unexpected errors by the presence and truth +of ``"paste.throw_errors"`` (this is sometimes set outside of testing +fixtures too, when the error-handling middleware is in place). + +Frameworks that want to expose the inner structure of the request may +use ``"paste.testing_variables"``. This will be a dictionary -- any +values put into that dictionary will become attributes of the response +object. So if you do ``env["paste.testing_variables"]['template'] = +template_name`` in your framework, then ``response.template`` will be +``template_name``. -- cgit v1.2.1