Commit 70022619 authored by Vincent Pelletier's avatar Vincent Pelletier

Cache result of Base_getFieldDescription.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10434 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 51e98c26
...@@ -68,20 +68,25 @@ ...@@ -68,20 +68,25 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>desc = field.get_value(\'description\')\n <value> <string>from Products.ERP5Type.Cache import CachingMethod\n
\n \n
if desc in (\'\', None):\n def getFieldDescription():\n
id = field.getId().split(\'_\', 1)\n desc = field.get_value(\'description\')\n
if id[0] == \'my\':\n if desc in (\'\', None):\n
try:\n id = field.getId().split(\'_\', 1)\n
properties = context.propertyMap()\n if id[0] == \'my\':\n
except AttributeError: # If context has no propertyMap, give up\n try:\n
properties = []\n properties = context.propertyMap()\n
for property in properties:\n except AttributeError: # If context has no propertyMap, give up\n
if id[1] == property[\'id\']:\n properties = []\n
return property.get(\'description\', \'\')\n for property in properties:\n
if id[1] == property[\'id\']:\n
return property.get(\'description\', \'\')\n
return desc\n
\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> </string> </value>
</item> </item>
<item> <item>
...@@ -131,16 +136,12 @@ return desc\n ...@@ -131,16 +136,12 @@ return desc\n
<value> <value>
<tuple> <tuple>
<string>field</string> <string>field</string>
<string>Products.ERP5Type.Cache</string>
<string>CachingMethod</string>
<string>getFieldDescription</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>desc</string>
<string>None</string>
<string>id</string>
<string>_getitem_</string>
<string>context</string> <string>context</string>
<string>properties</string> <string>None</string>
<string>AttributeError</string>
<string>_getiter_</string>
<string>property</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
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