[Kimchi-devel] [PATCH] [Wok 3/4] Fix issue with converting message to unicode

Lucio Correia luciojhc at linux.vnet.ibm.com
Fri Aug 5 19:03:16 UTC 2016


Signed-off-by: Lucio Correia <luciojhc at linux.vnet.ibm.com>
---
 src/wok/message.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/wok/message.py b/src/wok/message.py
index 35f40be..ff4cbc9 100644
--- a/src/wok/message.py
+++ b/src/wok/message.py
@@ -22,6 +22,7 @@
 import cherrypy
 import gettext
 
+from wok.stringutils import decode_value
 from wok.template import get_lang, validate_language
 
 
@@ -36,7 +37,7 @@ class WokMessage(object):
 
             try:
                 # In case the value formats itself to an ascii string.
-                args[key] = unicode(str(value), 'utf-8')
+                args[key] = decode_value(value)
             except UnicodeEncodeError:
                 # In case the value is a WokException or it formats
                 # itself to a unicode string.
@@ -85,7 +86,7 @@ class WokMessage(object):
 
     def get_text(self, prepend_code=True, translate=True):
         msg = self._get_text(translate)
-        msg = unicode(msg, 'utf-8') % self.args
+        msg = decode_value(msg) % self.args
 
         if prepend_code:
             return "%s: %s" % (self.code, msg)
-- 
1.9.1




More information about the Kimchi-devel mailing list