[Zope3-checkins] CVS: ZODB3/ZConfig - matcher.py:1.13

Jeremy Hylton jeremy@zope.com
Wed, 28 May 2003 09:17:12 -0400


Update of /cvs-repository/ZODB3/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv22278

Modified Files:
	matcher.py 
Log Message:
Repair error reporting for section with no name.


=== ZODB3/ZConfig/matcher.py 1.12 => 1.13 ===
--- ZODB3/ZConfig/matcher.py:1.12	Thu May  1 15:34:57 2003
+++ ZODB3/ZConfig/matcher.py	Wed May 28 09:17:12 2003
@@ -134,6 +134,10 @@
         object."""
         values = self._values
         for key, ci in self.type:
+            if key:
+                key = repr(key)
+            else:
+                key = "section type " + `ci.sectiontype.name`
             assert ci.attribute is not None
             attr = ci.attribute
             v = values[attr]
@@ -146,12 +150,8 @@
             if v is None and ci.minOccurs:
                 default = ci.getdefault()
                 if default is None:
-                    if key:
-                        s = `key`
-                    else:
-                        s = "section type " + `ci.sectiontype.name`
                     raise ZConfig.ConfigurationError(
-                        "no values for %s; %s required" % (s, ci.minOccurs))
+                        "no values for %s; %s required" % (key, ci.minOccurs))
                 else:
                     v = values[attr] = default[:]
             if ci.ismulti():
@@ -160,7 +160,7 @@
                 if len(v) < ci.minOccurs:
                     raise ZConfig.ConfigurationError(
                         "not enough values for %s; %d found, %d required"
-                        % (`key`, len(v), ci.minOccurs))
+                        % (key, len(v), ci.minOccurs))
             if v is None and not ci.issection():
                 if ci.ismulti():
                     v = ci.getdefault()[:]