[Zope3-checkins] CVS: Packages/ZConfig - loader.py:1.1.2.17

Fred L. Drake, Jr. fred@zope.com
Thu, 19 Dec 2002 16:06:10 -0500


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

Modified Files:
      Tag: zconfig-schema-devel-branch
	loader.py 
Log Message:
startSection():  When a section matches an abstract type, throw a
                 reasonable exception.


=== Packages/ZConfig/loader.py 1.1.2.16 => 1.1.2.17 ===
--- Packages/ZConfig/loader.py:1.1.2.16	Mon Dec 16 13:26:09 2002
+++ Packages/ZConfig/loader.py	Thu Dec 19 16:06:09 2002
@@ -129,6 +129,11 @@
     def startSection(self, parent, type, name, delegatename):
         if delegatename:
             raise NotImpementedError("section delegation is not yet supported")
+        t = self.schema.gettype(type)
+        if t.istypegroup():
+            raise ZConfig.ConfigurationError(
+                "concrete sections cannot match abstract section types;"
+                " found abstract type " + `type`)
         info = parent.info
         info = getattr(info, "sectiontype", info)
         ci = info.getsectioninfo(type, name)
@@ -137,8 +142,7 @@
             raise ZConfig.ConfigurationError(
                 "%s is not an allowed name for %s sections"
                 % (`name`, `ci.sectiontype.name`))
-        return matcher.SectionMatcher(ci, self.schema.gettype(type), name,
-                                      self.handlers)
+        return matcher.SectionMatcher(ci, t, name, self.handlers)
 
     def endSection(self, parent, type, name, delegatename, matcher):
         assert not delegatename