[Zope-Checkins] CVS: Zope/lib/python/ZConfig - matcher.py:1.10

Fred L. Drake, Jr. fred@zope.com
Mon, 24 Mar 2003 09:57:06 -0500


Update of /cvs-repository/Zope/lib/python/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv20232

Modified Files:
	matcher.py 
Log Message:
Remove exposure of an undocumented mis-feature in the public API.
There are still simplifications to be made in the internals.


=== Zope/lib/python/ZConfig/matcher.py 1.9 => 1.10 ===
--- Zope/lib/python/ZConfig/matcher.py:1.9	Wed Feb 19 15:35:38 2003
+++ Zope/lib/python/ZConfig/matcher.py	Mon Mar 24 09:57:06 2003
@@ -253,9 +253,10 @@
     """
 
     def __init__(self, attrnames, values, name, matcher):
+        assert len(attrnames) == len(values)
         d = self.__dict__
-        d['_attrnames'] = attrnames
-        d['_values'] = values
+        for i in range(len(attrnames)):
+            setattr(self, attrnames[i], values[i])
         d['_name'] = name
         d['_matcher'] = matcher
 
@@ -268,34 +269,6 @@
             name = "at %#x" % id(self)
         clsname = self.__class__.__name__
         return "<%s for %s %s>" % (clsname, self._matcher.type.name, name)
-
-    def __len__(self):
-        return len(self._values)
-
-    def __getitem__(self, index):
-        if isinstance(index, types.SliceType):
-            raise TypeError("SectionValue does not support slicing")
-        return self._values[index]
-
-    def __setitem__(self, index, value):
-        if isinstance(index, types.SliceType):
-            raise TypeError("SectionValue does not support slicing")
-        self._values[index] = value
-
-    def __getattr__(self, name):
-        try:
-            i = self._attrnames.index(name)
-        except ValueError:
-            raise AttributeError, name
-        return self._values[i]
-
-    def __setattr__(self, name, value):
-        try:
-            i = self._attrnames.index(name)
-        except ValueError:
-            self.__dict__[name] = value
-        else:
-            self._values[i] = value
 
     def __str__(self):
         l = []