[Zope-CVS] CVS: Products/Ape/lib/apelib/config - apeconf.py:1.1.2.2
Shane Hathaway
shane@zope.com
Mon, 7 Jul 2003 23:58:41 -0400
Update of /cvs-repository/Products/Ape/lib/apelib/config
In directory cvs.zope.org:/tmp/cvs-serv13815/config
Modified Files:
Tag: ape-newconf-branch
apeconf.py
Log Message:
Added a SQL variant to apeconf.xml and fixed uncovered bugs
=== Products/Ape/lib/apelib/config/apeconf.py 1.1.2.1 => 1.1.2.2 ===
--- Products/Ape/lib/apelib/config/apeconf.py:1.1.2.1 Mon Jul 7 18:59:13 2003
+++ Products/Ape/lib/apelib/config/apeconf.py Mon Jul 7 23:58:05 2003
@@ -160,7 +160,7 @@
def handle_mapper(source, vars, attrs):
d = vars['directives']
- mapper_name = attrs['name']
+ mapper_name = str(attrs['name'])
vars['mapper_name'] = mapper_name
d.append(MapperDeclaration(source, mapper_name))
for key in ('class', 'parent', 'extends'):
@@ -234,6 +234,13 @@
first = 0
d.append(ClassifierOption(
source, mapper_name, 'default_extension', ext))
+ elif attr == 'key':
+ try:
+ v = int(v)
+ except ValueError:
+ v = str(v)
+ d.append(MapperRegistration(
+ source, mapper_name, attr, v))
else:
d.append(MapperRegistration(
source, mapper_name, attr, v))
@@ -412,9 +419,13 @@
r = self.single_comps.get('classifier')
if r:
o = r['producer'](self.compsys)
+ self.classifier = o
if o is not None:
self.obj.setClassifier(o)
self.subobjs.append(o)
+ gw = o.getGateway()
+ if gw is not None:
+ self.subobjs.append(gw)
def setKeygen(self):
r = self.single_comps.get('keygen')
@@ -438,7 +449,6 @@
"""Registers classifications on behalf of sub-mappers."""
all_regs = {} # { (attr, value) -> mapper_name }
all_options = {} # { (mapper_name, option) -> value }
- need_classifier = 0
for name in self.sub_mapper_names:
# use-for directives
records = self.dtables.query(
@@ -451,7 +461,6 @@
name, all_regs[key],
r['attr'], repr(r['value'])))
all_regs[key] = name
- need_classifier = 1
# class="" attributes
class_name = self.dtables.queryField(
@@ -475,20 +484,16 @@
ClassifierOption, mapper_name=name)
for r in records:
all_options[(name, r['option'])] = r['value']
- need_classifier = 1
if all_regs or all_options:
- cfr = self.obj.getClassifier()
- if cfr is None:
- if not need_classifier:
- return
+ if self.classifier is None:
raise AssemblyError(
"Mapper %s needs a classifier because it has "
"sub-mappers with registrations" % self.mapper_name)
for (attr, value), name in all_regs.items():
- cfr.register(attr, value, name)
+ self.classifier.register(attr, value, name)
for (name, option), value in all_options.items():
- cfr.setOption(name, option, value)
+ self.classifier.setOption(name, option, value)
def makeComponentSystem(filenames, vnames=('',)):