[Erp5-report] r10434 - /erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/porta...
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Sep 29 18:39:34 CEST 2006
Author: vincent
Date: Fri Sep 29 18:39:32 2006
New Revision: 10434
URL: http://svn.erp5.org?rev=10434&view=rev
Log:
Cache result of Base_getFieldDescription.
Modified:
erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getFieldDescription.xml
Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getFieldDescription.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getFieldDescription.xml?rev=10434&r1=10433&r2=10434&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getFieldDescription.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getFieldDescription.xml Fri Sep 29 18:39:32 2006
@@ -68,20 +68,25 @@
</item>
<item>
<key> <string>_body</string> </key>
- <value> <string>desc = field.get_value(\'description\')\n
+ <value> <string>from Products.ERP5Type.Cache import CachingMethod\n
\n
-if desc in (\'\', None):\n
- id = field.getId().split(\'_\', 1)\n
- if id[0] == \'my\':\n
- try:\n
- properties = context.propertyMap()\n
- except AttributeError: # If context has no propertyMap, give up\n
- properties = []\n
- for property in properties:\n
- if id[1] == property[\'id\']:\n
- return property.get(\'description\', \'\')\n
+def getFieldDescription():\n
+ desc = field.get_value(\'description\')\n
+ if desc in (\'\', None):\n
+ id = field.getId().split(\'_\', 1)\n
+ if id[0] == \'my\':\n
+ try:\n
+ properties = context.propertyMap()\n
+ except AttributeError: # If context has no propertyMap, give up\n
+ properties = []\n
+ for property in properties:\n
+ if id[1] == property[\'id\']:\n
+ return property.get(\'description\', \'\')\n
+ return desc\n
\n
-return desc\n
+getFieldDescription = CachingMethod(getFieldDescription, (\'getFieldDescription\', field.aq_parent.getId(), field.getId(), context.Localizer.get_selected_language()), cache_duration=None)\n
+\n
+return getFieldDescription()\n
</string> </value>
</item>
<item>
@@ -131,16 +136,12 @@
<value>
<tuple>
<string>field</string>
+ <string>Products.ERP5Type.Cache</string>
+ <string>CachingMethod</string>
+ <string>getFieldDescription</string>
<string>_getattr_</string>
- <string>desc</string>
+ <string>context</string>
<string>None</string>
- <string>id</string>
- <string>_getitem_</string>
- <string>context</string>
- <string>properties</string>
- <string>AttributeError</string>
- <string>_getiter_</string>
- <string>property</string>
</tuple>
</value>
</item>
More information about the Erp5-report
mailing list