summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-04-21 23:42:51 -0400
committerChris McDonough <chrism@plope.com>2011-04-21 23:42:51 -0400
commitba0a5f88d916d97fe52540a535b8b5520815201a (patch)
tree2210b9e549d2b7d13a9168005e5b761bce7634c0
parent65a5a94e13e49b29b34287ede881d323505a281b (diff)
downloadpyramid-ba0a5f88d916d97fe52540a535b8b5520815201a.tar.gz
pyramid-ba0a5f88d916d97fe52540a535b8b5520815201a.tar.bz2
pyramid-ba0a5f88d916d97fe52540a535b8b5520815201a.zip
add changelog entries, fix docs for wsgiapp2
-rw-r--r--CHANGES.txt13
-rw-r--r--pyramid/wsgi.py14
2 files changed, 22 insertions, 5 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 5f08606be..c8b264587 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -136,6 +136,13 @@ Bug Fixes
- Redirects issued by a static view did not take into account any existing
``SCRIPT_NAME`` (such as one set by a url mapping composite). Now they do.
+- The ``pyramid.wsgi.wsgiapp2`` decorator did not take into account the
+ ``SCRIPT_NAME`` in the origin request.
+
+- The ``pyramid.wsgi.wsgiapp2`` decorator effectively only worked when it
+ decorated a view found via traversal; it ignored the ``PATH_INFO`` that was
+ part of a url-dispatch-matched view.
+
Deprecations
------------
@@ -169,6 +176,12 @@ Behavior Changes
renderer changes the content type (to ``application/json`` or
``text/plain`` for JSON and string renderers respectively).
+- The ``pyramid.wsgi.wsgiapp2`` now uses a slightly different method of
+ figuring out how to "fix" ``SCRIPT_NAME`` and ``PATH_INFO`` for the
+ downstream application. As a result, those values may differ slightly from
+ the perspective of the downstream application (for example, ``SCRIPT_NAME``
+ will now never possess a trailing slash).
+
Dependencies
------------
diff --git a/pyramid/wsgi.py b/pyramid/wsgi.py
index 47a89c0eb..e4c61ff63 100644
--- a/pyramid/wsgi.py
+++ b/pyramid/wsgi.py
@@ -31,7 +31,7 @@ def wsgiapp(wrapped):
"""
def decorator(context, request):
return request.get_response(wrapped)
- return wraps(wrapped)(decorator) # grokkability
+ return wraps(wrapped)(decorator)
def wsgiapp2(wrapped):
""" Decorator to turn a WSGI application into a :app:`Pyramid`
@@ -56,10 +56,14 @@ def wsgiapp2(wrapped):
config.add_view(hello_world, name='hello_world.txt')
The ``wsgiapp2`` decorator will convert the result of the WSGI
- application to a Response and return it to :app:`Pyramid` as if
- the WSGI app were a :app:`Pyramid` view. The ``SCRIPT_NAME``
- and ``PATH_INFO`` values present in the WSGI environment are fixed
- up before the application is invoked. """
+ application to a Response and return it to :app:`Pyramid` as if the WSGI
+ app were a :app:`Pyramid` view. The ``SCRIPT_NAME`` and ``PATH_INFO``
+ values present in the WSGI environment are fixed up before the
+ application is invoked. In particular, a new WSGI environment is
+ generated, and the :term:`subpath` of the request passed to ``wsgiapp2``
+ is used as the new request's ``PATH_INFO`` and everything preceding the
+ subpath is used as the ``SCRIPT_NAME``. The new environment is passed to
+ the downstream WSGI application."""
def decorator(context, request):
return call_app_with_subpath_as_path_info(request, wrapped)