[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools - locationmap.py:1.14
Fred L. Drake, Jr.
fred at zope.com
Thu May 13 11:24:38 EDT 2004
Update of /cvs-repository/Packages/zpkgtools/zpkgtools
In directory cvs.zope.org:/tmp/cvs-serv24914
Modified Files:
locationmap.py
Log Message:
fromPathOrUrl(): revise to use abstract URL handling from the
zpkgtools.loader module to allow loading location maps from Subversion
URLs
=== Packages/zpkgtools/zpkgtools/locationmap.py 1.13 => 1.14 ===
--- Packages/zpkgtools/zpkgtools/locationmap.py:1.13 Fri May 7 15:33:27 2004
+++ Packages/zpkgtools/zpkgtools/locationmap.py Thu May 13 11:24:38 2004
@@ -97,28 +97,20 @@
# still need to support Subversion here
if os.path.isfile(path):
# prefer a revision-control URL over a local path if possible:
- cvsurl = cvsloader.fromPath(path)
- if cvsurl is None:
+ rcurl = loader.fromPath(path)
+ if rcurl is None:
base = os.path.dirname(path)
else:
- cvsurl.path = posixpath.dirname(cvsurl.path)
- base = cvsurl.getUrl()
+ base = loader.baseUrl(rcurl)
f = open(path, "rU")
else:
try:
- cvsurl = cvsloader.parse(path)
+ cvsurl = loader.parse(path)
except ValueError:
- f = urllib2.urlopen(path)
- parts = list(urlparse.urlparse(path))
- if parts[2]:
- parts[2] = posixpath.join(posixpath.dirname(parts[2]), "")
- base = urlparse.urlunparse(parts)
- else:
- base = path
+ f = urllib2.urlopen(path, "rU")
else:
f = loader.open(path, "rU")
- cvsurl.path = posixpath.dirname(cvsurl.path)
- base = cvsurl.getUrl()
+ base = loader.baseUrl(path)
try:
return load(f, base, mapping)
finally:
More information about the Zope-CVS
mailing list