Commit 59175bf7 authored by Sebastien Robin's avatar Sebastien Robin

added try/except because sometimes get_context does not work


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6064 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a1bb5219
......@@ -69,9 +69,11 @@
<value> <string>from Products.CMFCore.utils import getToolByName\n
translation_service = getToolByName(context, \'Localizer\', None)\n
if translation_service is not None :\n
return translation_service.translate(catalog, msg, **kw).encode(encoding)\n
else :\n
return msg\n
try:\n
return translation_service.translate(catalog, msg, **kw).encode(encoding)\n
except AttributeError: # This happens in unit testing, because it is not able to find something with get_context()\n
pass\n
return msg\n
</string> </value>
</item>
<item>
......@@ -129,6 +131,7 @@ else :\n
<string>translation_service</string>
<string>_getattr_</string>
<string>_apply_</string>
<string>AttributeError</string>
</tuple>
</value>
</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