diff options
| author | Chris McDonough <chrism@plope.com> | 2011-09-23 06:38:31 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-09-23 06:38:31 -0400 |
| commit | e84232ed948179d019974f04ad77b5c11a8e5a3f (patch) | |
| tree | d535da90f457bc1d2bb28ead3b835354fbc16daa | |
| parent | 8e606da0d09f7e99baa08b91fe97dba4b5b5d4b2 (diff) | |
| download | pyramid-e84232ed948179d019974f04ad77b5c11a8e5a3f.tar.gz pyramid-e84232ed948179d019974f04ad77b5c11a8e5a3f.tar.bz2 pyramid-e84232ed948179d019974f04ad77b5c11a8e5a3f.zip | |
fix on python 2
| -rw-r--r-- | pyramid/request.py | 6 | ||||
| -rw-r--r-- | pyramid/traversal.py | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/pyramid/request.py b/pyramid/request.py index fda233388..cfab88860 100644 --- a/pyramid/request.py +++ b/pyramid/request.py @@ -401,12 +401,12 @@ def call_app_with_subpath_as_path_info(request, app): environ = request.environ script_name = environ.get('SCRIPT_NAME', '') path_info = environ.get('PATH_INFO', '/') - subpath = getattr(request, 'subpath', ()) + subpath = list(getattr(request, 'subpath', ())) new_script_name = '' # compute new_path_info - new_path_info = '/' + '/'.join([native_(x, 'utf-8') for x in subpath]) + new_path_info = '/' + '/'.join([x.encode('utf-8') for x in subpath]) if new_path_info != '/': # don't want a sole double-slash if path_info != '/': # if orig path_info is '/', we're already done @@ -424,7 +424,7 @@ def call_app_with_subpath_as_path_info(request, app): break el = workback.pop() if el: - tmp.insert(0, native_(el, 'utf-8')) + tmp.insert(0, el.decode('utf-8')) # strip all trailing slashes from workback to avoid appending undue slashes # to end of script_name diff --git a/pyramid/traversal.py b/pyramid/traversal.py index 897e01751..d05805c06 100644 --- a/pyramid/traversal.py +++ b/pyramid/traversal.py @@ -483,7 +483,7 @@ def traversal_path(path): for segment in path.split('/'): segment = url_unquote(segment) try: - segment = native_(segment, 'utf-8') + segment = text_(segment, 'utf-8') except UnicodeDecodeError as e: raise URLDecodeError(e.encoding, e.object, e.start, e.end, e.reason) if not segment or segment == '.': @@ -531,7 +531,7 @@ def quote_path_segment(segment, safe=''): return _segment_cache[(segment, safe)] except KeyError: if segment.__class__ is text_type: # isinstance slighly slower (~15%) - result = url_quote(native_(segment, 'utf-8'), safe) + result = url_quote(segment.encode('utf-8'), safe) else: result = url_quote(native_(segment), safe) # we don't need a lock to mutate _segment_cache, as the below |
