Commit 548d0501 authored by Vincent Pelletier's avatar Vincent Pelletier

Don't fail when the context has no getPropertyMap method (like ERP5Site).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9972 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2825ea43
...@@ -73,7 +73,10 @@ ...@@ -73,7 +73,10 @@
if desc in (\'\', None):\n if desc in (\'\', None):\n
id = field.getId().split(\'_\', 1)\n id = field.getId().split(\'_\', 1)\n
if id[0] == \'my\':\n if id[0] == \'my\':\n
properties = context.propertyMap()\n try:\n
properties = context.propertyMap()\n
except AttributeError: # If context has no propertyMap, give up\n
properties = []\n
for property in properties:\n for property in properties:\n
if id[1] == property[\'id\']:\n if id[1] == property[\'id\']:\n
return property.get(\'description\', \'\')\n return property.get(\'description\', \'\')\n
...@@ -135,6 +138,7 @@ return desc\n ...@@ -135,6 +138,7 @@ return desc\n
<string>_getitem_</string> <string>_getitem_</string>
<string>context</string> <string>context</string>
<string>properties</string> <string>properties</string>
<string>AttributeError</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>property</string> <string>property</string>
</tuple> </tuple>
......
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