Commit c319dc11 authored by Alexandre Boeglin's avatar Alexandre Boeglin

Base_translateString: do not try to encode if encoding is None or an empty...

Base_translateString: do not try to encode if encoding is None or an empty string (still defaults to 'utf8')

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20036 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c9b5e8aa
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -78,6 +75,8 @@ from Products.CMFCore.utils import getToolByName\n
translation_service = getToolByName(context, \'Localizer\', None)\n
if translation_service is not None :\n
try:\n
if not encoding:\n
return translation_service.translate(catalog, msg, lang=lang, **kw)\n
return translation_service.translate(catalog, msg, lang=lang, **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
......@@ -140,8 +139,8 @@ return msg\n
<string>context</string>
<string>None</string>
<string>translation_service</string>
<string>_getattr_</string>
<string>_apply_</string>
<string>_getattr_</string>
<string>AttributeError</string>
</tuple>
</value>
......
754
\ No newline at end of file
755
\ No newline at end of file
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