From: Matt Giuca Date: Tue, 14 Feb 2012 01:57:49 +0000 (+1100) Subject: Simplify requote_path. X-Git-Tag: v0.10.2~21^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1ffce4f7dcb646c4c4b357c214aa9ad77e69f645;p=services%2Fpython-requests.git Simplify requote_path. It no longer needs to split on '/' since '/' will not be encoded. --- diff --git a/requests/utils.py b/requests/utils.py index f4f98c4..abbc752 100644 --- a/requests/utils.py +++ b/requests/utils.py @@ -425,10 +425,8 @@ def requote_path(path): This function passes the given path through an unquote/quote cycle to ensure that it is fully and consistently quoted. """ - parts = path.split("/") # Unquote only the unreserved characters # Then quote only illegal characters (do not quote reserved, unreserved, # or '%') - parts = (quote(unquote_unreserved(part), safe="!#$%&'()*+,/:;=?@[]~") - for part in parts) + return quote(unquote_unreserved(path), safe="!#$%&'()*+,/:;=?@[]~") return "/".join(parts)