[FIX] don't coerce values to str before writing them to the worksheet in excel export
authorXavier Morel <xmo@openerp.com>
Tue, 30 Aug 2011 13:43:05 +0000 (15:43 +0200)
committerXavier Morel <xmo@openerp.com>
Tue, 30 Aug 2011 13:43:05 +0000 (15:43 +0200)
especially since xlwt is perfectly able to deal with unicode instances without blowing up like a 'tard

bzr revid: xmo@openerp.com-20110830134305-iu354whbr0c0kvpw

addons/base/controllers/main.py

index ab583d9..85f8e77 100644 (file)
@@ -1308,8 +1308,8 @@ class ExcelExport(Export):
 
         for row_index, row in enumerate(rows):
             for cell_index, cell_value in enumerate(row):
-                cell_value = str(cell_value)
-                cell_value = re.sub("\r", " ", cell_value)
+                if isinstance(cell_value, basestring):
+                    cell_value = re.sub("\r", " ", cell_value)
                 worksheet.write(row_index + 1, cell_index, cell_value, style)
 
         fp = StringIO()