[Zope-CVS] CVS: Products/Ape/lib/apelib/config - apeconf.py:1.4.2.4
common.py:1.2.4.1 minitables.py:NONE
Shane Hathaway
shane at zope.com
Thu Dec 25 16:52:41 EST 2003
Update of /cvs-repository/Products/Ape/lib/apelib/config
In directory cvs.zope.org:/tmp/cvs-serv11216/lib/apelib/config
Modified Files:
Tag: ape-0_8-branch
apeconf.py common.py
Removed Files:
Tag: ape-0_8-branch
minitables.py
Log Message:
Switched from minitables to zodbtables.
zodbtables is a more mature version of minitables. Unlike
minitables, zodbtables is able to persist the database in ZODB, and the
results of queries are Record objects rather than dictionaries, so the
results have attributes in addition to items.
=== Products/Ape/lib/apelib/config/apeconf.py 1.4.2.3 => 1.4.2.4 ===
--- Products/Ape/lib/apelib/config/apeconf.py:1.4.2.3 Tue Dec 23 00:52:35 2003
+++ Products/Ape/lib/apelib/config/apeconf.py Thu Dec 25 16:52:10 2003
@@ -22,7 +22,7 @@
from apelib.core.gateways import CompositeGateway
from apelib.core.interfaces import IDatabaseInitializer, ConfigurationError
-from minitables import Table, TableSchema
+from apelib.zodb3.zodbtables import Table, TableSchema
from common import Directive, DirectiveReader, ComponentSystem
@@ -298,7 +298,7 @@
self.subobjs = [] # all subobjects
self.attrs = {}
for record in dtables.query(MapperAttribute, mapper_name=name):
- self.attrs[record['name']] = record['value']
+ self.attrs[record.name] = record.value
self.prepareSubComponents()
def prepareSubComponents(self):
@@ -311,8 +311,8 @@
records = dtables.query(
MapperComponent, mapper_name=name)
for r in records:
- d = self.multi_comps.setdefault(r['comptype'], {})
- d.setdefault(r['name'], r)
+ d = self.multi_comps.setdefault(r.comptype, {})
+ d.setdefault(r.name, r)
name = dtables.queryField(
MapperAttribute, 'value', mapper_name=name, name='extends')
if name and name in all_names:
@@ -347,11 +347,11 @@
d = self.multi_comps.get('serializer')
if d:
- ordered = [(r.get('order', '').lower(), name, r)
+ ordered = [((r.order or '').lower(), name, r)
for name, r in d.items()]
ordered.sort()
for order, name, r in ordered:
- o = r['producer'](self.compsys)
+ o = r.producer(self.compsys)
if o is not None:
s.add(str(name), o)
self.subobjs.append(o)
@@ -362,7 +362,7 @@
d = self.multi_comps.get('gateway')
if d:
for name, r in d.items():
- o = r['producer'](self.compsys)
+ o = r.producer(self.compsys)
if o is not None:
g.add(str(name), o)
self.subobjs.append(o)
@@ -390,7 +390,7 @@
dtables = self.compsys.dtables
all_regs = {} # { (attr, value) -> mapper_name }
all_options = {} # { (mapper_name, option) -> value }
- mapper_names = [r['mapper_name'] for r in
+ mapper_names = [r.mapper_name for r in
dtables.query(MapperDeclaration)]
# Gather classification options from each mapper configuration.
for name in mapper_names:
@@ -398,12 +398,12 @@
records = dtables.query(
MapperUseFor, mapper_name=name)
for r in records:
- key = ((r['attr'], r['value']))
+ key = ((r.attr, r.value))
if all_regs.has_key(key) and all_regs[key] != name:
raise ConfigurationError(
"Mappers %s and %s are contending over %s == %s" % (
name, all_regs[key],
- repr(r['attr']), repr(r['value'])))
+ repr(r.attr), repr(r.value)))
all_regs[key] = name
register_class = dtables.queryField(
@@ -430,7 +430,7 @@
records = dtables.query(
ClassifierOption, mapper_name=name)
for r in records:
- all_options[(name, r['option'])] = r['value']
+ all_options[(name, r.option)] = r.value
# Perform the registrations.
if all_regs or all_options:
@@ -456,7 +456,7 @@
cs.addComponentType(comptype, BasicComponentAssembler)
mappers = {}
for record in cs.dtables.query(MapperDeclaration):
- name = record['mapper_name']
+ name = record.mapper_name
mappers[name] = cs.get('mapper', name)
classifier = cs.get('classifier', '')
oid_gen = cs.get('oid_generator', '')
=== Products/Ape/lib/apelib/config/common.py 1.2 => 1.2.4.1 ===
--- Products/Ape/lib/apelib/config/common.py:1.2 Wed Jul 9 11:39:55 2003
+++ Products/Ape/lib/apelib/config/common.py Thu Dec 25 16:52:10 2003
@@ -19,7 +19,7 @@
import xml.sax.handler
from xml.sax import parse
-import minitables
+from apelib.zodb3 import zodbtables
class Directive:
@@ -41,8 +41,9 @@
kw[key] = args[n]
self.data = kw
unique_key = [self.__class__]
- for name in self.schema.getPrimaryNames():
- unique_key.append(kw[name])
+ for column in self.schema.columns:
+ if column.primary:
+ unique_key.append(kw[column.name])
self.unique_key = tuple(unique_key)
def getUniqueKey(self):
@@ -51,7 +52,7 @@
def index(self, tables):
t = tables.get(self.__class__)
if t is None:
- t = minitables.Table(self.schema)
+ t = zodbtables.Table(self.schema)
tables[self.__class__] = t
t.insert(self.data)
=== Removed File Products/Ape/lib/apelib/config/minitables.py ===
More information about the Zope-CVS
mailing list