[Zope3-checkins] CVS: Packages/ZConfig - matcher.py:1.1.2.7

Fred L. Drake, Jr. fred@zope.com
Wed, 11 Dec 2002 16:07:51 -0500


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

Modified Files:
      Tag: zconfig-schema-devel-branch
	matcher.py 
Log Message:
Better exception messages.


=== Packages/ZConfig/matcher.py 1.1.2.6 => 1.1.2.7 ===
--- Packages/ZConfig/matcher.py:1.1.2.6	Wed Dec 11 15:18:15 2002
+++ Packages/ZConfig/matcher.py	Wed Dec 11 16:07:51 2002
@@ -89,11 +89,18 @@
         for i in range(length):
             key, ci = self.info[i]
             keys[i] = ci.attribute
-            if ci.ismulti() and len(self._values[i]) < ci.minOccurs:
+            v = self._values[i]
+            if v is None and ci.minOccurs:
+                if key:
+                    s = `key`
+                else:
+                    s = "section type " + `ci.typename`
+                raise ZConfig.ConfigurationError(
+                    "no values for %s; %s required" % (s, ci.minOccurs))
+            if ci.ismulti() and len(v) < ci.minOccurs:
                 raise ZConfig.ConfigurationError(
                     "not enough values for %s; %d found, %d required"
                     % (`key`, len(L), ci.minOccurs))
-            v = self._values[i]
             if v is None:
                 if ci.ismulti():
                     v = ci.getdefault()[:]