[Zope-Checkins] CVS: Packages/ZConfig - Context.py:1.3
Fred L. Drake, Jr.
fdrake@acm.org
Mon, 14 Oct 2002 16:23:43 -0400
Update of /cvs-repository/Packages/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv12340
Modified Files:
Context.py
Log Message:
Make the check for path names more reasonable in a cross-platform way.
This should fix the errors seen on Windows, but I can't easily test
until I get back to my home machine.
=== Packages/ZConfig/Context.py 1.2 => 1.3 ===
--- Packages/ZConfig/Context.py:1.2 Thu Oct 10 16:42:24 2002
+++ Packages/ZConfig/Context.py Mon Oct 14 16:23:42 2002
@@ -1,6 +1,7 @@
"""Top-level configuration handle."""
import os
+import urllib
import urllib2
import urlparse
@@ -43,13 +44,8 @@
def load(self, url):
"""Load a resource from a URL or pathname."""
- parts = urlparse.urlsplit(url)
- if not parts[0]:
- # must be a filename
- path = os.path.abspath(url)
- if os.sep != "/":
- path = path.replace(os.sep, "/")
- url = "file://" + path
+ if os.path.exists(url):
+ url = "file://" + urllib.pathname2url(os.path.abspath(url))
top = self.createToplevelSection(url)
self._imports = [top]
self._parse_url(url, top)