diff options
author | ianb <devnull@localhost> | 2005-11-03 04:08:18 +0000 |
---|---|---|
committer | ianb <devnull@localhost> | 2005-11-03 04:08:18 +0000 |
commit | 4a4ebf30597c01699663e40f83b406a6747d2b41 (patch) | |
tree | c643ad4fe5392f631694c9635e8b7d09c03b6ead /docs/testing-applications.txt | |
parent | 62942b24647380e511e9341e5af66024f5621121 (diff) | |
download | paste-4a4ebf30597c01699663e40f83b406a6747d2b41.tar.gz |
Added hook for frameworks to add custom variables to the response object
Diffstat (limited to 'docs/testing-applications.txt')
-rw-r--r-- | docs/testing-applications.txt | 19 |
1 files changed, 18 insertions, 1 deletions
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``. |