[Zope-CVS] CVS: Packages/zpkgtools/zpkgtools - cvsloader.py:1.10
Fred L. Drake, Jr.
fred at zope.com
Thu Mar 18 17:50:18 EST 2004
Update of /cvs-repository/Packages/zpkgtools/zpkgtools
In directory cvs.zope.org:/tmp/cvs-serv21935
Modified Files:
cvsloader.py
Log Message:
add hackery to make the CvsLoader work with file: URLs; this is useful
for testing
=== Packages/zpkgtools/zpkgtools/cvsloader.py 1.9 => 1.10 ===
--- Packages/zpkgtools/zpkgtools/cvsloader.py:1.9 Fri Mar 12 17:11:17 2004
+++ Packages/zpkgtools/zpkgtools/cvsloader.py Thu Mar 18 17:50:18 2004
@@ -19,6 +19,8 @@
import re
import shutil
import tempfile
+import urllib
+import urlparse
class CvsLoadingError(Exception):
@@ -221,6 +223,17 @@
try:
url = parse(url)
except ValueError:
+ # XXX Hack to make this support file: URLs to ease
+ # testing with filesystem-based resources. There
+ # really should be some sort of dispatch mechanism,
+ # but we won't do that right now.
+ parts = urlparse.urlparse(url)
+ if parts[0] == "file" and not parts[1]:
+ fn = urllib.url2pathname(parts[2])
+ if os.path.exists(fn):
+ return fn
+ raise ValueError(
+ "file: URL refers to non-existant resource")
raise TypeError(
"load() requires a cvs or repository URL; received %r"
% url)
More information about the Zope-CVS
mailing list