[Zodb-checkins] CVS: Packages/ZConfig - __init__.py:1.3.10.2 Exceptions.py:NONE
Fred L. Drake, Jr.
fred@zope.com
Tue, 10 Dec 2002 14:16:49 -0500
Update of /cvs-repository/Packages/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv29283
Modified Files:
Tag: zconfig-schema-devel-branch
__init__.py
Removed Files:
Tag: zconfig-schema-devel-branch
Exceptions.py
Log Message:
Remove the Exceptions module since the API requires the exceptions are
provided by the ZConfig package top-level.
=== Packages/ZConfig/__init__.py 1.3.10.1 => 1.3.10.2 ===
--- Packages/ZConfig/__init__.py:1.3.10.1 Tue Dec 10 11:28:03 2002
+++ Packages/ZConfig/__init__.py Tue Dec 10 14:16:49 2002
@@ -16,8 +16,6 @@
$Id$
"""
-from ZConfig.Exceptions import *
-
def load(url):
import Context
return Context.Context().load(url)
@@ -33,3 +31,62 @@
def loadschemafile(file, url=None):
import loader
return loader.SchemaLoader().loadfile(file, url)
+
+
+class ConfigurationError(Exception):
+ def __init__(self, msg):
+ self.message = msg
+ Exception.__init__(self, msg)
+
+ def __str__(self):
+ return self.message
+
+
+class ConfigurationMissingSectionError(ConfigurationError):
+ def __init__(self, type, name=None):
+ self.type = type
+ self.name = name
+ details = 'Missing section (type: %s' % type
+ if name is not None:
+ details += ', name: %s' % name
+ ConfigurationError.__init__(self, details + ')')
+
+
+class ConfigurationConflictingSectionError(ConfigurationError):
+ def __init__(self, type, name=None):
+ self.type = type
+ self.name = name
+ details = 'Conflicting sections (type: %s' % type
+ if name is not None:
+ details += ', name: %s' % name
+ ConfigurationError.__init__(self, details + ')')
+
+
+class ConfigurationSyntaxError(ConfigurationError):
+ def __init__(self, msg, url, lineno):
+ self.url = url
+ self.lineno = lineno
+ ConfigurationError.__init__(self, msg)
+
+ def __str__(self):
+ return "%s\n(line %s in %s)" % (self.message, self.lineno, self.url)
+
+
+class ConfigurationTypeError(ConfigurationError):
+ def __init__(self, msg, found, expected):
+ self.found = found
+ self.expected = expected
+ ConfigurationError.__init__(self, msg)
+
+
+class SubstitutionSyntaxError(ConfigurationError):
+ """Raised when interpolation source text contains syntactical errors."""
+
+
+class SubstitutionReplacementError(ConfigurationError, LookupError):
+ """Raised when no replacement is available for a reference."""
+
+ def __init__(self, source, name):
+ self.source = source
+ self.name = name
+ ConfigurationError.__init__(self, "no replacement for " + `name`)
=== Removed File Packages/ZConfig/Exceptions.py ===