[Zope3-checkins] CVS: StandaloneZConfig/ZConfig - __init__.py:1.16 loader.py:1.32

Fred L. Drake, Jr. fred at zope.com
Wed Feb 11 16:32:17 EST 2004


Update of /cvs-repository/StandaloneZConfig/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv23803/ZConfig

Modified Files:
	__init__.py loader.py 
Log Message:
move the "url" attribute to the base ConfigurationError exception,
and set it in more places


=== StandaloneZConfig/ZConfig/__init__.py 1.15 => 1.16 ===
--- StandaloneZConfig/ZConfig/__init__.py:1.15	Wed Feb 11 16:18:54 2004
+++ StandaloneZConfig/ZConfig/__init__.py	Wed Feb 11 16:31:46 2004
@@ -22,8 +22,9 @@
 from ZConfig.loader import loadSchema, loadSchemaFile
 
 class ConfigurationError(Exception):
-    def __init__(self, msg):
+    def __init__(self, msg, url=None):
         self.message = msg
+        self.url = url
         Exception.__init__(self, msg)
 
     def __str__(self):
@@ -32,10 +33,9 @@
 
 class _ParseError(ConfigurationError):
     def __init__(self, msg, url, lineno, colno=None):
-        self.url = url
         self.lineno = lineno
         self.colno = colno
-        ConfigurationError.__init__(self, msg)
+        ConfigurationError.__init__(self, msg, url)
 
     def __str__(self):
         s = self.message


=== StandaloneZConfig/ZConfig/loader.py 1.31 => 1.32 ===
--- StandaloneZConfig/ZConfig/loader.py:1.31	Thu Feb  5 12:03:04 2004
+++ StandaloneZConfig/ZConfig/loader.py	Wed Feb 11 16:31:46 2004
@@ -115,19 +115,19 @@
         else:
             what = "URL"
             ident = url
-        error = ZConfig.ConfigurationError("error opening %s %s: %s"
-                                           % (what, ident, message))
-        error.url = url
-        raise error
+        raise ZConfig.ConfigurationError(
+            "error opening %s %s: %s" % (what, ident, message),
+            url)
 
     def normalizeURL(self, url):
         if self.isPath(url):
             url = "file://" + urllib.pathname2url(os.path.abspath(url))
-        url, fragment = ZConfig.url.urldefrag(url)
+        newurl, fragment = ZConfig.url.urldefrag(url)
         if fragment:
             raise ZConfig.ConfigurationError(
-                "fragment identifiers are not supported")
-        return url
+                "fragment identifiers are not supported",
+                url)
+        return newurl
 
     def isPath(self, s):
         """Return True iff 's' should be handled as a filesystem path."""




More information about the Zope3-Checkins mailing list