[FIX] Decode to utf-8
authorStephane Wirtel <stephane@tinyerp.com>
Tue, 3 Feb 2009 14:08:30 +0000 (15:08 +0100)
committerStephane Wirtel <stephane@tinyerp.com>
Tue, 3 Feb 2009 14:08:30 +0000 (15:08 +0100)
[IMP] Don't compute twice the xml stream

lp bug: https://launchpad.net/bugs/324759 fixed

bzr revid: stephane@tinyerp.com-20090203140830-ij2s919zywxs9fvi

addons/base_module_record/base_module_record.py

index fa9c8a6..9cfa505 100644 (file)
@@ -182,7 +182,7 @@ class base_module_record(osv.osv):
                     val = str(val)
 
                 val = val and ('"""%s"""' % val.replace('\\', '\\\\').replace('"', '\"')) or 'False'
-                field.setAttribute(u"eval",  val)
+                field.setAttribute(u"eval",  val.decode('utf-8'))
                 record.appendChild(field)
         return record_list, noupdate
 
@@ -324,8 +324,8 @@ class base_module_record(osv.osv):
                         data.appendChild(res)
                 elif rec[0]=='assert':
                         pass
-            res = doc.toprettyxml(indent="\t")
-            return  doc.toprettyxml(indent="\t").encode('utf8')
+
+            return doc.toprettyxml(indent="\t").encode('utf-8')
 base_module_record()
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: