[Zope-Checkins] CVS: Zope/lib/python/ZConfig - Common.py:1.1.4.2 Context.py:1.1.4.2

Chris McDonough chrism@zope.com
Tue, 15 Oct 2002 20:54:08 -0400


Update of /cvs-repository/Zope/lib/python/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv22840

Modified Files:
      Tag: chrism-install-branch
	Common.py Context.py 
Log Message:
Merging ZConfig on chrism-install-branch with its HEAD.


=== Zope/lib/python/ZConfig/Common.py 1.1.4.1 => 1.1.4.2 ===
--- Zope/lib/python/ZConfig/Common.py:1.1.4.1	Thu Oct 10 14:29:12 2002
+++ Zope/lib/python/ZConfig/Common.py	Tue Oct 15 20:53:38 2002
@@ -24,7 +24,7 @@
     def __init__(self, type, name=None):
         self.type = type
         self.name = name
-        details = 'Missing section, type: %s' % type
+        details = 'Missing section (type: %s' % type
         if name is not None:
             details += ', name: %s' % name
         ConfigurationError.__init__(self, details + ')')
@@ -34,7 +34,7 @@
     def __init__(self, type, name=None):
         self.type = type
         self.name = name
-        details = 'Conflicting sections, (type: %s' % type
+        details = 'Conflicting sections (type: %s' % type
         if name is not None:
             details += ', name: %s' % name
         ConfigurationError.__init__(self, details + ')')
@@ -42,7 +42,6 @@
 
 class ConfigurationSyntaxError(ConfigurationError):
     def __init__(self, msg, url, lineno):
-        self.message = msg
         self.url = url
         self.lineno = lineno
         ConfigurationError.__init__(self, msg)
@@ -53,7 +52,6 @@
 
 class ConfigurationTypeError(ConfigurationError):
     def __init__(self, msg, found, expected):
-        self.message = msg
         self.found = found
         self.expected = expected
         ConfigurationError.__init__(self, msg)


=== Zope/lib/python/ZConfig/Context.py 1.1.4.1 => 1.1.4.2 ===
--- Zope/lib/python/ZConfig/Context.py:1.1.4.1	Thu Oct 10 14:29:12 2002
+++ Zope/lib/python/ZConfig/Context.py	Tue Oct 15 20:53:38 2002
@@ -1,6 +1,9 @@
 """Top-level configuration handle."""
 
+import os
+import urllib
 import urllib2
+import urlparse
 
 from Common import *
 from Config import Configuration, ImportingConfiguration
@@ -40,6 +43,9 @@
     # public API
 
     def load(self, url):
+        """Load a resource from a URL or pathname."""
+        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)
@@ -105,6 +111,9 @@
     # internal helpers
 
     def _parse_url(self, url, section):
+        if urlparse.urlparse(url)[-1]:
+            raise ConfigurationError(
+                "fragment identifiers are not currently supported")
         file = urllib2.urlopen(url)
         self._current_imports.append(section)
         try: