[Zope-Checkins] CVS: Zope3/src/ZConfig - cfgparser.py:1.10 loader.py:1.26

Fred L. Drake, Jr. fred at zope.com
Tue Oct 7 13:53:43 EDT 2003


Update of /cvs-repository/Zope3/src/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv22651

Modified Files:
	cfgparser.py loader.py 
Log Message:
Remove some cruftiness that had to be maintained before the old API was
ripped out; this now represents unused code.


=== Zope3/src/ZConfig/cfgparser.py 1.9 => 1.10 ===
--- Zope3/src/ZConfig/cfgparser.py:1.9	Fri Oct  3 16:01:56 2003
+++ Zope3/src/ZConfig/cfgparser.py	Tue Oct  7 13:53:43 2003
@@ -36,7 +36,7 @@
         self.file = resource.file
         self.url = resource.url
         self.lineno = 0
-        self.stack = []   # [(type, name, delegatename, prevmatcher), ...]
+        self.stack = []   # [(type, name, prevmatcher), ...]
         if defines is None:
             defines = {}
         self.defs = defines
@@ -89,33 +89,32 @@
         m = _section_start_rx.match(text)
         if not m:
             self.error("malformed section header")
-        type, name, delegatename = m.group('type', 'name', 'delegatename')
+        type, name = m.group('type', 'name')
         type = type.lower()
         if name:
             name = name.lower()
         try:
-            newsect = self.context.startSection(section, type, name,
-                                                delegatename)
+            newsect = self.context.startSection(section, type, name)
         except ZConfig.ConfigurationError, e:
             self.error(e[0])
 
         if isempty:
-            self.context.endSection(section, type, name, delegatename, newsect)
+            self.context.endSection(section, type, name, newsect)
             return section
         else:
-            self.stack.append((type, name, delegatename, section))
+            self.stack.append((type, name, section))
             return newsect
 
     def end_section(self, section, rest):
         if not self.stack:
             self.error("unexpected section end")
         type = rest.rstrip().lower()
-        opentype, name, delegatename, prevsection = self.stack.pop()
+        opentype, name, prevsection = self.stack.pop()
         if type != opentype:
             self.error("unbalanced section end")
         try:
             self.context.endSection(
-                prevsection, type, name, delegatename, section)
+                prevsection, type, name, section)
         except ZConfig.ConfigurationError, e:
             self.error(e[0])
         return prevsection
@@ -186,15 +185,13 @@
 
 
 import re
-# _name_re cannot allow "(" or ")" since we need to be able to tell if
-# a section has a name or not: <section (name)> would be ambiguous if
-# parentheses were allowed in names.
+# _name_re does not allow "(" or ")" for historical reasons.  Though
+# the restriction could be lifted, there seems no need to do so.
 _name_re = r"[^\s()]+"
 _keyvalue_rx = re.compile(r"(?P<key>%s)\s*(?P<value>[^\s].*)?$"
                           % _name_re)
 _section_start_rx = re.compile(r"(?P<type>%s)"
                                r"(?:\s+(?P<name>%s))?"
-                               r"(?:\s*[(](?P<delegatename>%s)[)])?"
                                r"$"
-                               % (_name_re, _name_re, _name_re))
+                               % (_name_re, _name_re))
 del re


=== Zope3/src/ZConfig/loader.py 1.25 => 1.26 ===
--- Zope3/src/ZConfig/loader.py:1.25	Tue Oct  7 09:55:11 2003
+++ Zope3/src/ZConfig/loader.py	Tue Oct  7 13:53:43 2003
@@ -189,10 +189,7 @@
 
     # config parser support API
 
-    def startSection(self, parent, type, name, delegatename):
-        if delegatename:
-            raise NotImplementedError(
-                "section delegation is not yet supported")
+    def startSection(self, parent, type, name):
         t = self.schema.gettype(type)
         if t.isabstract():
             raise ZConfig.ConfigurationError(
@@ -200,8 +197,7 @@
                 " found abstract type " + `type`)
         return parent.createChildMatcher(t, name)
 
-    def endSection(self, parent, type, name, delegatename, matcher):
-        assert not delegatename
+    def endSection(self, parent, type, name, matcher):
         sectvalue = matcher.finish()
         parent.addSection(type, name, sectvalue)
 




More information about the Zope-Checkins mailing list