[Zope-Checkins] CVS: Packages/SFTPGateway/src/ZConfig -
info.py:1.20 schema.py:1.30
Fred L. Drake, Jr.
fred at zope.com
Fri Jan 2 00:35:34 EST 2004
Update of /cvs-repository/Packages/SFTPGateway/src/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv12643
Modified Files:
info.py schema.py
Log Message:
allow "keytype" to be overridden in derived section types
=== Packages/SFTPGateway/src/ZConfig/info.py 1.19 => 1.20 ===
--- Packages/SFTPGateway/src/ZConfig/info.py:1.19 Fri Oct 3 16:01:56 2003
+++ Packages/SFTPGateway/src/ZConfig/info.py Fri Jan 2 00:35:03 2004
@@ -403,11 +403,11 @@
self.addtype(t)
return t
- def deriveSectionType(self, base, name, valuetype, datatype):
+ def deriveSectionType(self, base, name, keytype, valuetype, datatype):
if isinstance(base, SchemaType):
raise ZConfig.SchemaError(
"cannot derive sectiontype from top-level schema")
- t = self.createSectionType(name, base.keytype, valuetype, datatype)
+ t = self.createSectionType(name, keytype, valuetype, datatype)
t._attrmap.update(base._attrmap)
t._keymap.update(base._keymap)
t._children.extend(base._children)
=== Packages/SFTPGateway/src/ZConfig/schema.py 1.29 => 1.30 ===
--- Packages/SFTPGateway/src/ZConfig/schema.py:1.29 Fri Jan 2 00:27:16 2004
+++ Packages/SFTPGateway/src/ZConfig/schema.py Fri Jan 2 00:35:03 2004
@@ -205,7 +205,7 @@
self.error(e[0])
def get_sect_typeinfo(self, attrs, base=None):
- keytype = self.get_datatype(attrs, "keytype", "basic-key")
+ keytype = self.get_datatype(attrs, "keytype", "basic-key", base)
valuetype = self.get_datatype(attrs, "valuetype", "string")
datatype = self.get_datatype(attrs, "datatype", "null", base)
return keytype, valuetype, datatype
@@ -333,11 +333,9 @@
base = self._schema.gettype(basename)
if base.isabstract():
self.error("sectiontype cannot extend an abstract type")
- if attrs.has_key("keytype"):
- self.error("derived sectiontype may not specify a keytype")
keytype, valuetype, datatype = self.get_sect_typeinfo(attrs, base)
sectinfo = self._schema.deriveSectionType(
- base, name, valuetype, datatype)
+ base, name, keytype, valuetype, datatype)
else:
keytype, valuetype, datatype = self.get_sect_typeinfo(attrs)
sectinfo = self._schema.createSectionType(
More information about the Zope-Checkins
mailing list