[Zope-CVS] CVS: Products/Ape/lib/apelib/fs - structure.py:1.2.2.1
Shane Hathaway
shane@zope.com
Tue, 24 Jun 2003 17:39:14 -0400
Update of /cvs-repository/Products/Ape/lib/apelib/fs
In directory cvs.zope.org:/tmp/cvs-serv2045/fs
Modified Files:
Tag: ape-newconf-branch
structure.py
Log Message:
Reduced the number of things necessary to configure in a mapper.
This change centered around removing the arguments to the constructor
in zope2.basemapper. They were making it hard to write a
configuration vocabulary.
Removed the app_key argument through the use of a read-only gateway
instead of a fixed persistent mapping, and removed the
stored_keychains argument by always storing keychains. The filesystem
version of the folder items gateway doesn't actually store the
keychains, but it can verify that when the keychains are loaded again
they will be the same as they were at storage time.
=== Products/Ape/lib/apelib/fs/structure.py 1.2 => 1.2.2.1 ===
--- Products/Ape/lib/apelib/fs/structure.py:1.2 Tue Apr 29 18:11:50 2003
+++ Products/Ape/lib/apelib/fs/structure.py Tue Jun 24 17:38:43 2003
@@ -88,6 +88,7 @@
schema = RowSequenceSchema()
schema.addField('id', 'string', 1)
+ schema.addField('keychain', 'keychain')
def load(self, event):
p = event.getKey()
@@ -95,7 +96,11 @@
assert c.readNodeType(p) == 'd'
names = c.readData(p)
names.sort()
- res = tuple([(name,) for name in names])
+ res = []
+ for name in names:
+ keychain = event.makeKeychain(name, 0)
+ res.append((name, keychain))
+ res = tuple(res)
return res, res
def store(self, event, state):
@@ -104,6 +109,12 @@
c.writeNodeType(p, 'd')
state = list(state)
state.sort()
+ if __debug__:
+ for name, keychain in state:
+ expect = event.makeKeychain(name, 0)
+ assert expect == keychain, (
+ "Child of %s named %s must use keychain %s, but used %s" %
+ (event.getKeychain(), name, expect, keychain))
names = [row[0] for row in state]
c.writeData(p, names)
return tuple(state)