[FIX] ir_translation: apply tools.ustr on the trad itself
authorDenis Ledoux <dle@odoo.com>
Fri, 3 Oct 2014 10:08:49 +0000 (12:08 +0200)
committerDenis Ledoux <dle@odoo.com>
Fri, 3 Oct 2014 10:08:49 +0000 (12:08 +0200)
tools.ustr(None) returns u'None', res[0] can be None.

openerp/addons/base/ir/ir_translation.py

index f8eecc7..0ff497e 100644 (file)
@@ -336,11 +336,11 @@ class ir_translation(osv.osv):
                            AND name=%s""",
                     (lang or '', types, tools.ustr(name)))
         res = cr.fetchone()
-        trad = res and tools.ustr(res[0]) or u''
+        trad = res and res[0] or u''
         if source and not trad:
             return tools.ustr(source)
         # Remove control characters
-        return filter(lambda c: unicodedata.category(c) != 'Cc', trad)
+        return filter(lambda c: unicodedata.category(c) != 'Cc', tools.ustr(trad))
 
     def create(self, cr, uid, vals, context=None):
         if context is None: