diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-06-22 00:12:45 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-06-22 00:12:45 +0000 |
| commit | 6ecdbc409d2109a9e7fc5367c64067f0400f07cc (patch) | |
| tree | 37a01b7f6d9c9fe10f8201bf67d89dfd480e9072 /repoze/bfg/wsgi.py | |
| parent | 352276d69311cbd2ec4985b4e809b607102c2dab (diff) | |
| download | pyramid-6ecdbc409d2109a9e7fc5367c64067f0400f07cc.tar.gz pyramid-6ecdbc409d2109a9e7fc5367c64067f0400f07cc.tar.bz2 pyramid-6ecdbc409d2109a9e7fc5367c64067f0400f07cc.zip | |
- Adding ``*path_info`` to a route no longer changes the PATH_INFO for
a request that matches using URL dispatch. This feature was only
there to service the ``repoze.bfg.wsgi.wsgiapp2`` decorator and it
did it wrong; use ``*subpath`` instead now.
- The interface generation performed for named request factories had the
wrong base classes.
Diffstat (limited to 'repoze/bfg/wsgi.py')
| -rw-r--r-- | repoze/bfg/wsgi.py | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/repoze/bfg/wsgi.py b/repoze/bfg/wsgi.py index c7853c035..3991d3344 100644 --- a/repoze/bfg/wsgi.py +++ b/repoze/bfg/wsgi.py @@ -71,32 +71,21 @@ def wsgiapp2(wrapped): """ def decorator(context, request): traversed = request.traversed - if traversed is not None: - # We need to fix up PATH_INFO and SCRIPT_NAME to give the - # subapplication the right information, sans the info it - # took to traverse here. If ``traversed`` is None here, - # it means that no traversal was done. For example, it - # will be None in the case that the context is one - # obtained via a Routes match (Routes 'traversal' doesn't - # actually traverse). If this view is invoked on a Routes - # context, this fixup is not invoked. Instead, the route - # used to reach it should use *path_info in the actual - # route pattern to get a similar fix-up done. - vroot_path = request.virtual_root_path or [] - view_name = request.view_name - subpath = request.subpath or [] - script_list = traversed[len(vroot_path):] - script_list = [ quote_path_segment(name) for name in script_list ] - if view_name: - script_list.append(quote_path_segment(view_name)) - script_name = '/' + '/'.join(script_list) - path_list = [ quote_path_segment(name) for name in subpath ] - path_info = '/' + '/'.join(path_list) - request.environ['PATH_INFO'] = path_info - script_name = request.environ['SCRIPT_NAME'] + script_name - if script_name.endswith('/'): - script_name = script_name[:-1] - request.environ['SCRIPT_NAME'] = script_name + vroot_path = request.virtual_root_path or [] + view_name = request.view_name + subpath = request.subpath or () + script_list = traversed[len(vroot_path):] + script_list = [ quote_path_segment(name) for name in script_list ] + if view_name: + script_list.append(quote_path_segment(view_name)) + script_name = '/' + '/'.join(script_list) + path_list = [ quote_path_segment(name) for name in subpath ] + path_info = '/' + '/'.join(path_list) + request.environ['PATH_INFO'] = path_info + script_name = request.environ['SCRIPT_NAME'] + script_name + if script_name.endswith('/'): + script_name = script_name[:-1] + request.environ['SCRIPT_NAME'] = script_name return request.get_response(wrapped) return wraps(wrapped)(decorator) # grokkability |
