diff options
| author | Michael Merickel <michael@merickel.org> | 2018-11-13 10:31:58 -0600 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2018-11-13 10:31:58 -0600 |
| commit | 656ce2b499bd05ceb9b0ae492a0be15a07dc283f (patch) | |
| tree | 522bb0545924d4a034871d41be2974229889ecb5 /src | |
| parent | e2c7bbf5566f5be4d1b5b58d3e23948b4dc9b651 (diff) | |
| download | pyramid-656ce2b499bd05ceb9b0ae492a0be15a07dc283f.tar.gz pyramid-656ce2b499bd05ceb9b0ae492a0be15a07dc283f.tar.bz2 pyramid-656ce2b499bd05ceb9b0ae492a0be15a07dc283f.zip | |
get rid of some unnecessary constants
Diffstat (limited to 'src')
| -rw-r--r-- | src/pyramid/traversal.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/pyramid/traversal.py b/src/pyramid/traversal.py index 5ff8d22ad..5adf728b6 100644 --- a/src/pyramid/traversal.py +++ b/src/pyramid/traversal.py @@ -25,8 +25,6 @@ from pyramid.threadlocal import get_current_registry PATH_SEGMENT_SAFE = "~!$&'()*+,;=:@" # from webob PATH_SAFE = PATH_SEGMENT_SAFE + "/" -empty = '' - def find_root(resource): """ Find the root node in the resource tree to which ``resource`` @@ -594,9 +592,6 @@ def quote_path_segment(segment, safe=PATH_SEGMENT_SAFE): return result -slash = '/' - - @implementer(ITraverser) class ResourceTreeTraverser(object): """ A resource tree traverser that should be used (for speed) when @@ -616,12 +611,12 @@ class ResourceTreeTraverser(object): if matchdict is not None: - path = matchdict.get('traverse', slash) or slash + path = matchdict.get('traverse', '/') or '/' if is_nonstr_iter(path): # this is a *traverse stararg (not a {traverse}) # routing has already decoded these elements, so we just # need to join them - path = '/' + slash.join(path) or slash + path = '/' + '/'.join(path) or '/' subpath = matchdict.get('subpath', ()) if not is_nonstr_iter(subpath): @@ -635,10 +630,10 @@ class ResourceTreeTraverser(object): subpath = () try: # empty if mounted under a path in mod_wsgi, for example - path = request.path_info or slash + path = request.path_info or '/' except KeyError: # if environ['PATH_INFO'] is just not there - path = slash + path = '/' except UnicodeDecodeError as e: raise URLDecodeError( e.encoding, e.object, e.start, e.end, e.reason @@ -660,7 +655,7 @@ class ResourceTreeTraverser(object): root = self.root ob = vroot = root - if vpath == slash: # invariant: vpath must not be empty + if vpath == '/': # invariant: vpath must not be empty # prevent a call to traversal_path if we know it's going # to return the empty tuple vpath_tuple = () @@ -714,7 +709,7 @@ class ResourceTreeTraverser(object): return { 'context': ob, - 'view_name': empty, + 'view_name': '', 'subpath': subpath, 'traversed': vpath_tuple, 'virtual_root': vroot, |
