Commit 4607699e authored by Sebastien Robin's avatar Sebastien Robin

providesI[InterfaceName] will be calculated only once, then the

result will be stored in order to improve performance

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30713 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 11734eb5
...@@ -49,6 +49,12 @@ class Getter(Accessor): ...@@ -49,6 +49,12 @@ class Getter(Accessor):
def __init__(self, id, key): def __init__(self, id, key):
self._id = id self._id = id
self._key = key self._key = key
self._value = None
def __call__(self, instance): def __call__(self, instance):
return instance.provides(self._key) value = self._value
if value is None:
# Store the value for performance
value = instance.provides(self._key)
self._value = value
return value
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