[Python-3000-checkins] r64366 - in python/branches/py3k-urllib/Lib: test/support.py xml/dom/xmlbuilder.py xml/sax/saxutils.py

senthil.kumaran python-3000-checkins at python.org
Wed Jun 18 04:55:54 CEST 2008


Author: senthil.kumaran
Date: Wed Jun 18 04:55:54 2008
New Revision: 64366

Log:
changes to urllib references in xml/dom xml/sax and test/support.py

Modified:
   python/branches/py3k-urllib/Lib/test/support.py
   python/branches/py3k-urllib/Lib/xml/dom/xmlbuilder.py
   python/branches/py3k-urllib/Lib/xml/sax/saxutils.py

Modified: python/branches/py3k-urllib/Lib/test/support.py
==============================================================================
--- python/branches/py3k-urllib/Lib/test/support.py	(original)
+++ python/branches/py3k-urllib/Lib/test/support.py	Wed Jun 18 04:55:54 2008
@@ -352,10 +352,10 @@
         testcase.fail('Missing SyntaxError: "%s"' % statement)
 
 def open_urlresource(url, *args, **kw):
-    import urllib, urlparse
+    import urllib.request, urllib.parse
 
     requires('urlfetch')
-    filename = urlparse.urlparse(url)[2].split('/')[-1] # '/': it's URL!
+    filename = urllib.parse.urlparse(url)[2].split('/')[-1] # '/': it's URL!
 
     for path in [os.path.curdir, os.path.pardir]:
         fn = os.path.join(path, filename)
@@ -363,7 +363,7 @@
             return open(fn, *args, **kw)
 
     print('\tfetching %s ...' % url, file=get_original_stdout())
-    fn, _ = urllib.urlretrieve(url, filename)
+    fn, _ = urllib.request.urlretrieve(url, filename)
     return open(fn, *args, **kw)
 
 

Modified: python/branches/py3k-urllib/Lib/xml/dom/xmlbuilder.py
==============================================================================
--- python/branches/py3k-urllib/Lib/xml/dom/xmlbuilder.py	(original)
+++ python/branches/py3k-urllib/Lib/xml/dom/xmlbuilder.py	Wed Jun 18 04:55:54 2008
@@ -223,14 +223,14 @@
         source.encoding = self._guess_media_encoding(source)
 
         # determine the base URI is we can
-        import posixpath, urlparse
-        parts = urlparse.urlparse(systemId)
+        import posixpath, urllib.parse
+        parts = urllib.parse.urlparse(systemId)
         scheme, netloc, path, params, query, fragment = parts
         # XXX should we check the scheme here as well?
         if path and not path.endswith("/"):
             path = posixpath.dirname(path) + "/"
             parts = scheme, netloc, path, params, query, fragment
-            source.baseURI = urlparse.urlunparse(parts)
+            source.baseURI = urllib.parse.urlunparse(parts)
 
         return source
 

Modified: python/branches/py3k-urllib/Lib/xml/sax/saxutils.py
==============================================================================
--- python/branches/py3k-urllib/Lib/xml/sax/saxutils.py	(original)
+++ python/branches/py3k-urllib/Lib/xml/sax/saxutils.py	Wed Jun 18 04:55:54 2008
@@ -3,7 +3,7 @@
 convenience of application and driver writers.
 """
 
-import os, urlparse, urllib
+import os, urllib.parse, urllib.request
 from . import handler
 from . import xmlreader
 
@@ -289,8 +289,8 @@
             source.setSystemId(sysidfilename)
             f = open(sysidfilename, "rb")
         else:
-            source.setSystemId(urlparse.urljoin(base, sysid))
-            f = urllib.urlopen(source.getSystemId())
+            source.setSystemId(urllib.parse.urljoin(base, sysid))
+            f = urllib.request.urlopen(source.getSystemId())
 
         source.setByteStream(f)
 


More information about the Python-3000-checkins mailing list