[Zodb-checkins] CVS: Zope/lib/python/ZConfig - Config.py:1.2.4.5 SchemaParser.py:1.1.2.14 __init__.py:1.1.4.6

Chris McDonough chrism@zope.com
Tue, 26 Nov 2002 18:53:05 -0500


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

Modified Files:
      Tag: chrism-install-branch
	Config.py SchemaParser.py __init__.py 
Log Message:
Merge with HEAD and exorcise __getitem__.


=== Zope/lib/python/ZConfig/Config.py 1.2.4.4 => 1.2.4.5 ===
--- Zope/lib/python/ZConfig/Config.py:1.2.4.4	Sun Nov 24 18:28:43 2002
+++ Zope/lib/python/ZConfig/Config.py	Tue Nov 26 18:52:33 2002
@@ -60,7 +60,11 @@
         # get section by name, relative to this section
         type = type.lower()
         if name:
-            return self._sections_by_name[(type, name.lower())]
+            key = (type, name.lower())
+            try:
+                return self._sections_by_name[key]
+            except KeyError:
+                raise ConfigurationMissingSectionError(type, name)
         else:
             L = []
             for sect in self._sections:
@@ -132,18 +136,6 @@
                 if k not in L2:
                     L2.append(k)
             return L2
-
-    def __getitem__(self, key):
-        k = key.lower()
-        if self._data.has_key(k):
-            return self._data[k]
-        elif self.delegate:
-            v = self.delegate.get(k)
-            if v is None:
-                raise KeyError(key)
-            return v
-        else:
-            raise KeyError(key)
 
     def get(self, key, default=None):
         key = key.lower()


=== Zope/lib/python/ZConfig/SchemaParser.py 1.1.2.13 => 1.1.2.14 ===
--- Zope/lib/python/ZConfig/SchemaParser.py:1.1.2.13	Tue Nov 26 13:24:38 2002
+++ Zope/lib/python/ZConfig/SchemaParser.py	Tue Nov 26 18:52:33 2002
@@ -488,18 +488,6 @@
             else:
                 return self.delegate.get(key, default)
 
-    def __getitem__(self, key):
-        k = key.lower()
-        if self.hasSub(KEY_TYPE, KEY_TYPE, k):
-            return self.getSub(KEY_TYPE, KEY_TYPE, key).getValue()
-        elif self.delegate:
-            v = self.delegate.get(k)
-            if v is None:
-                raise KeyError(key)
-            return v
-        else:
-            raise KeyError(key)
-
     def items(self):
         """Returns a list of key-value pairs for this section.
 
@@ -653,9 +641,6 @@
         return self.current.addValue(name, value)
 
     def get(self, key, default=None):
-        raise NotImplementedError
-
-    def __getitem__(self, key):
         raise NotImplementedError
 
     def items(self):


=== Zope/lib/python/ZConfig/__init__.py 1.1.4.5 => 1.1.4.6 ===
--- Zope/lib/python/ZConfig/__init__.py:1.1.4.5	Sun Nov 24 18:53:32 2002
+++ Zope/lib/python/ZConfig/__init__.py	Tue Nov 26 18:52:33 2002
@@ -31,3 +31,7 @@
 def loadschemafile(file, schema, url=None):
     from SchemaParser import SchemaContext
     return SchemaContext().load(file, url, schema)
+
+def loadfile(file, url=None):
+    import Context
+    return Context.Context().loadfile(file, url)