[Zope3-checkins] CVS: Packages/ZConfig - info.py:1.1.2.18

Fred L. Drake, Jr. fred@zope.com
Fri, 20 Dec 2002 17:32:51 -0500


Update of /cvs-repository/Packages/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv3033

Modified Files:
      Tag: zconfig-schema-devel-branch
	info.py 
Log Message:
The only reason we'll ever see exceptions related to the _finished
flag is because there's a problem with the schema XML, so raise
SchemaError for these.


=== Packages/ZConfig/info.py 1.1.2.17 => 1.1.2.18 ===
--- Packages/ZConfig/info.py:1.1.2.17	Thu Dec 19 11:51:27 2002
+++ Packages/ZConfig/info.py	Fri Dec 20 17:32:51 2002
@@ -96,27 +96,30 @@
 
     def finish(self):
         if self._finished:
-            raise ValueError("cannot finish KeyInfo more than once")
+            raise ZConfig.SchemaError(
+                "cannot finish KeyInfo more than once")
         self._finished = True
 
     def adddefault(self, value):
         if self._finished:
-            raise ValueError("cannot add default values to finished KeyInfo")
+            raise ZConfig.SchemaError(
+                "cannot add default values to finished KeyInfo")
         if self.maxOccurs > 1:
             if self._default is None:
                 self._default = [value]
             else:
                 self._default.append(value)
         elif self._default is not None:
-            raise ValueError("cannot set more than one default to key with"
-                             " maxOccurs == 1")
+            raise ZConfig.SchemaError(
+                "cannot set more than one default to key with maxOccurs == 1")
         else:
             self._default = value
 
     def getdefault(self):
         if not self._finished:
-            raise ValueError("cannot get default value of key before KeyInfo"
-                             " has been completely initialized")
+            raise ZConfig.SchemaError(
+                "cannot get default value of key before KeyInfo"
+                " has been completely initialized")
         if self._default is None and self.maxOccurs > 1:
             return []
         else: