[Zope-CVS] CVS: Products/Ape/lib/apelib/fs - structure.py:1.6
Shane Hathaway
shane at zope.com
Tue Feb 17 00:25:42 EST 2004
Update of /cvs-repository/Products/Ape/lib/apelib/fs
In directory cvs.zope.org:/tmp/cvs-serv17338/lib/apelib/fs
Modified Files:
structure.py
Log Message:
Another big pile of changes resulted from a little time. :-)
>From CHANGES.txt:
- Removed the concepts of "classified state" and "hints", now
relying on the existing concepts of classification and state. This
primarily involved changes to classifiers and the apelib.core.io
module.
- Implemented the folder item classification optimization. Now,
when Ape loads a folder, it passes along the classification of each
subitem as part of the containing folder's state. This means fewer
round-trips.
Also fixed a couple of shallow bugs that prevented Ape from starting in
Zope.
=== Products/Ape/lib/apelib/fs/structure.py 1.5 => 1.6 ===
--- Products/Ape/lib/apelib/fs/structure.py:1.5 Mon Feb 2 10:07:20 2004
+++ Products/Ape/lib/apelib/fs/structure.py Tue Feb 17 00:25:11 2004
@@ -96,6 +96,7 @@
schema = RowSequenceSchema()
schema.addField('key', 'string', 1)
schema.addField('oid', 'string')
+ schema.addField('classification', 'classification')
def load(self, event):
p = event.oid
@@ -106,9 +107,10 @@
res = []
for name in names:
oid = event.conf.oid_gen.new_oid(event, name, False)
- res.append((name, oid))
- res = tuple(res)
- return res, res
+ classification = event.classify(oid)
+ # Return info about each subobject.
+ res.append((name, oid, classification))
+ return res, tuple(names)
def store(self, event, state):
p = event.oid
@@ -117,14 +119,14 @@
state = list(state)
state.sort()
if __debug__:
- for name, oid in state:
+ for name, oid, classification in state:
expect = event.conf.oid_gen.new_oid(event, name, False)
assert expect == oid, (
"Child of %s named %s must use OID %s, but used %s" %
(event.oid, name, expect, oid))
names = [row[0] for row in state]
c.writeDirectory(p, names)
- return tuple(state)
+ return tuple(names)
class FSModTime (FSGatewayBase):
@@ -156,9 +158,7 @@
__implements__ = IGateway
- schema = RowSequenceSchema()
- schema.addField('key', 'string', 1)
- schema.addField('oid', 'string')
+ schema = FSDirectoryItems.schema
def load(self, event):
p = event.oid
@@ -173,13 +173,13 @@
assert t == 'd', 'The root object must be a directory'
names = c.readDirectory(p)
names.sort()
- res = [('Application', '/')]
+ res = [('Application', '/', None)]
for name in names:
if name != 'Application':
oid = event.conf.oid_gen.new_oid(event, name, False)
- res.append((name, oid))
- res = tuple(res)
- return res, res
+ classification = event.classify(oid)
+ res.append((name, oid, classification))
+ return res, tuple(names)
def store(self, event, state):
p = event.oid
@@ -188,7 +188,7 @@
state = list(state)
state.sort()
names = []
- for name, oid in state:
+ for name, oid, classification in state:
if name == 'Application':
expect = '/'
else:
@@ -198,4 +198,5 @@
"Child of %s named %s must use OID %s, but used %s" %
(event.oid, name, expect, oid))
c.writeDirectory(p, names)
- return tuple(state)
+ names.sort()
+ return tuple(names)
More information about the Zope-CVS
mailing list