Commits

jayd3e committed 2bbc907

Reversed the changes made it last commit, as it would have broken in versions < 3.0, and I simply reset the urlparse module to the urllib.parse module at the start of some files

Comments (0)

Files changed (2)

 import six
 import sys, tempfile, warnings
-import cgi
-from urllib import parse
-if sys.version >= '2.7':
+import urllib, urlparse, cgi
+if six.PY3:
+    urlparse = urlib.parse
     from io import BytesIO as StringIO # pragma nocover
 else:
     from cStringIO import StringIO # pragma nocover
 __all__ = ['BaseRequest', 'Request']
 
 if sys.version >= '2.6':
-    parse_qsl = parse.parse_qsl
+    parse_qsl = urlparse.parse_qsl
 else:
     parse_qsl = cgi.parse_qsl # pragma nocover
 
                 url += '/'
         else:
             url = self.path_url
-        return parse.urljoin(url, other_url)
+        return urlparse.urljoin(url, other_url)
 
     def path_info_pop(self, pattern=None):
         """
         env = environ_from_url(path)
         environ_add_POST(env, POST)
         if base_url:
-            scheme, netloc, path, query, fragment = parse.urlsplit(base_url)
+            scheme, netloc, path, query, fragment = urlparse.urlsplit(base_url)
             if query or fragment:
                 six.reraise(ValueError(
                     "base_url (%r) cannot have a query or fragment"
 
 def environ_from_url(path):
     if SCHEME_RE.search(path):
-        scheme, netloc, path, qs, fragment = parse.urlsplit(path)
+        scheme, netloc, path, qs, fragment = urlparse.urlsplit(path)
         if fragment:
             six.reraise(TypeError("Path cannot contain a fragment (%r)" % fragment))
         if qs:

webob/response.py

 import six
-import re, zlib, struct
-from urllib import parse
+import re, urlparse, zlib, struct
 from datetime import datetime, date, timedelta
 
 from webob.headers import ResponseHeaders
 from webob.util import status_reasons
 from webob.request import StringIO
 
+if six.PY3:
+    urlparse = urlib.parse
+
 __all__ = ['Response']
 
 _PARAM_RE = re.compile(r'([a-z0-9]+)=(?:"([^"]*)"|([a-z0-9_.-]*))', re.I)
             if name.lower() == 'location':
                 if SCHEME_RE.search(value):
                     break
-                new_location = parse.urljoin(
+                new_location = urlparse.urljoin(
                     _request_uri(environ), value)
                 headerlist = list(headerlist)
                 idx = headerlist.index((name, value))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.