Commit 06a66dbb authored by Malthe Borch's avatar Malthe Borch

Optimize "OFS.ObjectManager.__contains__" method

parent 51d780c9
...@@ -48,6 +48,9 @@ Bugs Fixed ...@@ -48,6 +48,9 @@ Bugs Fixed
Features Added 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 - Optimized the `OFS.Traversable.getPhysicalPath` method to avoid excessive
amounts of method calls. amounts of method calls.
......
...@@ -781,7 +781,11 @@ class ObjectManager(CopyContainer, ...@@ -781,7 +781,11 @@ class ObjectManager(CopyContainer,
return self._setObject(key, value) return self._setObject(key, value)
def __contains__(self, name): 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): def __iter__(self):
return iter(self.objectIds()) 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