[views] use unicode instead of str in views/reports.py draft
authorDavid Douard <david.douard@logilab.fr>
Fri, 14 Nov 2014 10:48:37 +0100
changeset 1775 7fcbeba48fd4
parent 1774 873c8740c429
child 1776 f1a23fc56270
[views] use unicode instead of str in views/reports.py
views/reports.py
--- a/views/reports.py	Thu Nov 20 20:04:18 2014 +0100
+++ b/views/reports.py	Fri Nov 14 10:48:37 2014 +0100
@@ -114,7 +114,7 @@
             allchecks.add(cr.name)
             branches.setdefault(conf, set()).add(cr.execution.branch)
     allchecks = sorted(allchecks)
-    table = Table(cols=2+len(allchecks), klass='apycotreport',
+    table = Table(cols=2+len(allchecks), klass=u'apycotreport',
                   cheaders=2, rheaders=1, rrheaders=len(configs) > 5)
     # headers
     table.append(Text(_('name')))
@@ -131,26 +131,26 @@
         for branch in sorted(branches.get(conf, ())):
             if first_branch:
                 link = Link(xml_escape(conf.absolute_url()),
-                            '%s' % (conf_title,),
-                            klass='apycot_title')
-                table.append(Span((link,), klass='apycot_testname'))
+                            u'%s' % (conf_title,),
+                            klass=u'apycot_title')
+                table.append(Span((link,), klass=u'apycot_testname'))
             else:
                 table.append(Span(u' '))
             first_branch = False
             link = Link(xml_escape(conf.absolute_url()),
-                        '%s' % (xml_escape(branch or 'default'),),
-                        klass='apycot_title')
-            table.append(Span((link,), klass='apycot_branchname'))
+                        u'%s' % (xml_escape(branch or 'default'),),
+                        klass=u'apycot_title')
+            table.append(Span((link,), klass=u'apycot_branchname'))
             for column in allchecks:
                 checkresult = latest_check_result_by_name(conf, column, branch)
                 if checkresult:
                     status = checkresult.status
                     url = checkresult.execution.absolute_url(tab=column)
-                    title = Link(xml_escape(url), _(status), klass='apycot_title')
+                    title = Link(xml_escape(url), _(status), klass=u'apycot_title')
                 else:
                     title = _('nc')
-                    status = 'nc'
-                table.append(Span((title,), klass='status_%s' % status))
+                    status = u'nc'
+                table.append(Span((title,), klass=u'status_%s' % status))
     # recall table headers
     if len(configs) > 5:
         table.append(Text(_('name')))
@@ -160,5 +160,5 @@
     # dump html and return results
     stream = StringIO()
     writer = HTMLWriter(snippet=True)
-    writer.format(table, stream, 'unicode')
+    writer.format(table, stream, 'utf-8')
     return stream.getvalue()