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

  • Participants
  • Parent commits 0a68afa

Comments (0)

Files changed (2)

File webob/

 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
     from cStringIO import StringIO # pragma nocover
 __all__ = ['BaseRequest', 'Request']
 if sys.version >= '2.6':
-    parse_qsl = parse.parse_qsl
+    parse_qsl = urlparse.parse_qsl
     parse_qsl = cgi.parse_qsl # pragma nocover
                 url += '/'
             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:
                     "base_url (%r) cannot have a query or fragment"
 def environ_from_url(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:

File webob/

 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':
-                new_location = parse.urljoin(
+                new_location = urlparse.urljoin(
                     _request_uri(environ), value)
                 headerlist = list(headerlist)
                 idx = headerlist.index((name, value))