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,10 +341,13 @@ class BTreeFolder2Base (Persistent): ...@@ -341,10 +341,13 @@ 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:
mti = self._mt_index
if spec is None:
spec = mti.keys() #all meta types
if isinstance(spec, StringType): if isinstance(spec, StringType):
spec = [spec] spec = [spec]
mti = self._mt_index
set = None set = None
for meta_type in spec: for meta_type in spec:
ids = mti.get(meta_type, None) ids = mti.get(meta_type, None)
...@@ -354,8 +357,6 @@ class BTreeFolder2Base (Persistent): ...@@ -354,8 +357,6 @@ class BTreeFolder2Base (Persistent):
return () return ()
else: else:
return set.keys() return set.keys()
else:
return self._tree.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