[Erp5-report] r30713 - /erp5/trunk/products/ERP5Type/Accessor/Interface.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Nov 18 11:08:24 CET 2009


Author: seb
Date: Wed Nov 18 11:08:23 2009
New Revision: 30713

URL: http://svn.erp5.org?rev=30713&view=rev
Log:
providesI[InterfaceName] will be calculated only once, then the
result will be stored in order to improve performance

Modified:
    erp5/trunk/products/ERP5Type/Accessor/Interface.py

Modified: erp5/trunk/products/ERP5Type/Accessor/Interface.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Accessor/Interface.py?rev=30713&r1=30712&r2=30713&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Accessor/Interface.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Accessor/Interface.py [utf8] Wed Nov 18 11:08:23 2009
@@ -49,6 +49,12 @@
   def __init__(self, id, key):
     self._id = id
     self._key = key
+    self._value = None
 
   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




More information about the Erp5-report mailing list