[Zope-Checkins] CVS: Packages/ZConfig - schema.py:1.1.2.17

Fred L. Drake, Jr. fred@zope.com
Fri, 13 Dec 2002 16:08:12 -0500


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

Modified Files:
      Tag: zconfig-schema-devel-branch
	schema.py 
Log Message:
Handler names now have the basic-key datatype, not the Python
dotted-name type.


=== Packages/ZConfig/schema.py 1.1.2.16 => 1.1.2.17 ===
--- Packages/ZConfig/schema.py:1.1.2.16	Fri Dec 13 15:38:57 2002
+++ Packages/ZConfig/schema.py	Fri Dec 13 16:08:12 2002
@@ -37,6 +37,7 @@
 
     def __init__(self, registry):
         self._registry = registry
+        self._basic_key = registry.get("basic-key")
         self._identifier = registry.get("identifier")
         self._cdata = None
         self._locator = None
@@ -104,6 +105,13 @@
         else:
             return name
 
+    def get_handler(self, attrs):
+        v = attrs.get("handler")
+        if v is None:
+            return v
+        else:
+            return self._basic_key(v)
+
     def push_prefix(self, attrs):
         name = attrs.get("prefix", "")
         prefix = self.get_classname(name)
@@ -126,7 +134,7 @@
 
     def start_schema(self, attrs):
         self.push_prefix(attrs)
-        handler = self.get_classname(attrs.get("handler", "")) or None
+        handler = self.get_handler(attrs)
         keytype, valuetype, datatype = self.get_sect_typeinfo(attrs)
         self._schema = info.SchemaType(keytype, valuetype, datatype, handler)
         self._stack = [self._schema]
@@ -219,9 +227,7 @@
                 self.doSchemaError("minOccurs cannot be more than maxOccurs")
         else:
             minOccurs = None
-        handler = attrs.get("handler")
-        if handler:
-            handler = self.get_classname(handler)
+        handler = self.get_handler(attrs)
         return maxOccurs, minOccurs, handler
 
     def get_name_info(self, attrs):