[Zope3-checkins] CVS: Packages/ZConfig - schema.py:1.1.2.4

Fred L. Drake, Jr. fred@zope.com
Wed, 11 Dec 2002 13:41:05 -0500


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

Modified Files:
      Tag: zconfig-schema-devel-branch
	schema.py 
Log Message:
dict():  Introduced to support Python 2.1.

endDocument():  Check the schema against None, since schema are
    sequences and the minimal schema contains no items.


=== Packages/ZConfig/schema.py 1.1.2.3 => 1.1.2.4 ===
--- Packages/ZConfig/schema.py:1.1.2.3	Wed Dec 11 01:10:36 2002
+++ Packages/ZConfig/schema.py	Wed Dec 11 13:41:05 2002
@@ -8,6 +8,16 @@
 from ZConfig import info
 
 
+try:
+    dict
+except NameError:
+    def dict(mapping):
+        d = {}
+        for k, v in mapping.items():
+            d[k] = v
+        return d
+
+
 default_value_type = datatypes.get("str")
 default_key_type = datatypes.get("basic-key")
 default_name_type = default_key_type
@@ -76,7 +86,7 @@
                 setattr(self._stack[-1], name, data)
 
     def endDocument(self):
-        if not self._schema:
+        if self._schema is None:
             self.doSchemaError("no schema found")
 
     # schema loading logic