Commit 610d49be authored by Shane Hathaway's avatar Shane Hathaway

Sean Upton's optimization of BTreeFolder2.objectIds(). Should speed up

certain operations significantly.
parent 7470690c
...@@ -341,21 +341,22 @@ class BTreeFolder2Base (Persistent): ...@@ -341,21 +341,22 @@ class BTreeFolder2Base (Persistent):
# Returns a list of subobject ids of the current object. # Returns a list of subobject ids of the current object.
# If 'spec' is specified, returns objects whose meta_type # If 'spec' is specified, returns objects whose meta_type
# matches 'spec'. # matches 'spec'.
if spec is not None:
if isinstance(spec, StringType): mti = self._mt_index
spec = [spec] if spec is None:
mti = self._mt_index spec = mti.keys() #all meta types
set = None
for meta_type in spec: if isinstance(spec, StringType):
ids = mti.get(meta_type, None) spec = [spec]
if ids is not None: set = None
set = union(set, ids) for meta_type in spec:
if set is None: ids = mti.get(meta_type, None)
return () if ids is not None:
else: set = union(set, ids)
return set.keys() if set is None:
return ()
else: else:
return self._tree.keys() return set.keys()
security.declareProtected(access_contents_information, security.declareProtected(access_contents_information,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment