[Erp5-report] r29621 - /erp5/trunk/products/ERP5Type/Core/ActionInformation.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Oct 14 08:02:58 CEST 2009


Author: kazuhiko
Date: Wed Oct 14 08:02:56 2009
New Revision: 29621

URL: http://svn.erp5.org?rev=29621&view=rev
Log:
define getActionType() category accessor explicitly for better performance.

Modified:
    erp5/trunk/products/ERP5Type/Core/ActionInformation.py

Modified: erp5/trunk/products/ERP5Type/Core/ActionInformation.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/ActionInformation.py?rev=29621&r1=29620&r2=29621&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/ActionInformation.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/ActionInformation.py [utf8] Wed Oct 14 08:02:56 2009
@@ -165,3 +165,12 @@
                           self.getActionText(),
                           self.getConditionText()]
     return ' '.join(filter(None, search_source_list))
+
+  security.declareProtected(AccessContentsInformation, 'getActionType')
+  def getActionType(self):
+    # Since we should have only one category that starts with
+    # 'action_type/' here, we call self.categories[0][12:] (12 is the
+    # length of 'action_type/'), instead of self.getActionType() for
+    # better performance.
+    categories = getattr(self, 'categories', [])
+    return len(categories) and categories[0][12:] or None




More information about the Erp5-report mailing list