Commit 291af855 authored by Tres Seaver's avatar Tres Seaver Committed by GitHub

Merge pull request #60 from zopefoundation/patch1

Optimize "OFS.ObjectManager.__contains__" method
parents 51d780c9 06a66dbb
......@@ -48,6 +48,9 @@ Bugs Fixed
Features Added
++++++++++++++
- Optimized the `OFS.ObjectManager.__contains__` method to do the
least amount of work necessary.
- Optimized the `OFS.Traversable.getPhysicalPath` method to avoid excessive
amounts of method calls.
......
......@@ -781,7 +781,11 @@ class ObjectManager(CopyContainer,
return self._setObject(key, value)
def __contains__(self, name):
return name in self.objectIds()
for ob in self._objects:
if name == ob['id']:
return True
return False
def __iter__(self):
return iter(self.objectIds())
......
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