diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-06-26 03:39:27 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-06-26 03:39:27 +0000 |
| commit | 25cbe149246aba58b5eba4c13dc67260f09d3862 (patch) | |
| tree | e1d3dcc01ef3847d7a39a7c04de8d65da77ab386 /repoze/bfg/traversal.py | |
| parent | 1e40cf21f1bb41feee5f377db8b02a06657d2001 (diff) | |
| download | pyramid-25cbe149246aba58b5eba4c13dc67260f09d3862.tar.gz pyramid-25cbe149246aba58b5eba4c13dc67260f09d3862.tar.bz2 pyramid-25cbe149246aba58b5eba4c13dc67260f09d3862.zip | |
- Cause ``:segment`` matches in route paths to put a Unicode-decoded
and URL-dequoted value in the matchdict for the value matched.
Previously a non-decoded non-URL-dequoted string was placed in the
matchdict as the value.
- Cause ``*remainder`` matches in route paths to put a *tuple* in the
matchdict dictionary in order to be able to present Unicode-decoded
and URL-dequoted values for the traversal path. Previously a
non-decoded non-URL-dequoted string was placed in the matchdict as
the value.
Diffstat (limited to 'repoze/bfg/traversal.py')
| -rw-r--r-- | repoze/bfg/traversal.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/repoze/bfg/traversal.py b/repoze/bfg/traversal.py index b79f87d4c..374804df0 100644 --- a/repoze/bfg/traversal.py +++ b/repoze/bfg/traversal.py @@ -368,7 +368,7 @@ def virtual_root(model, request): urlgenerator = getMultiAdapter((model, request), IContextURL) return urlgenerator.virtual_root() -@lru_cache(500) +@lru_cache(1000) def traversal_path(path): """ Given a ``PATH_INFO`` string (slash-separated path segments), return a tuple representing that path which can be used to @@ -493,9 +493,17 @@ class ModelGraphTraverser(object): def __call__(self, environ): if 'bfg.routes.matchdict' in environ: matchdict = environ['bfg.routes.matchdict'] + path = matchdict.get('traverse', '/') - subpath = matchdict.get('subpath', '') - subpath = tuple(filter(None, subpath.split('/'))) + if hasattr(path, '__iter__'): + # this is a *traverse stararg (not a :traverse) + path = '/'.join([quote_path_segment(x) for x in path]) or '/' + + subpath = matchdict.get('subpath', ()) + if not hasattr(subpath, '__iter__'): + # this is not a *subpath stararg (just a :subpath) + subpath = traversal_path(subpath) + else: # this request did not match a Routes route subpath = () |
