From c319dc11d76a78695b7dca7b275c8953d3467a33 Mon Sep 17 00:00:00 2001
From: Alexandre Boeglin <alex@nexedi.com>
Date: Wed, 19 Mar 2008 13:47:43 +0000
Subject: [PATCH] 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
---
 .../portal_skins/erp5_core/Base_translateString.xml   | 11 +++++------
 product/ERP5/bootstrap/erp5_core/bt/revision          |  2 +-
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_translateString.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_translateString.xml
index db4d14edbc..889ec46b25 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_translateString.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_translateString.xml
@@ -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>
diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision
index 827de6e933..5d1d1b123b 100644
--- a/product/ERP5/bootstrap/erp5_core/bt/revision
+++ b/product/ERP5/bootstrap/erp5_core/bt/revision
@@ -1 +1 @@
-754
\ No newline at end of file
+755
\ No newline at end of file
-- 
2.30.9