← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~lifeless/python-oops-tools/bug-1048470 into lp:python-oops-tools

 

Robert Collins has proposed merging lp:~lifeless/python-oops-tools/bug-1048470 into lp:python-oops-tools.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1048470 in python-oops-tools: "UnicodeEncodeError with non-ascii page ids"
  https://bugs.launchpad.net/python-oops-tools/+bug/1048470

For more details, see:
https://code.launchpad.net/~lifeless/python-oops-tools/bug-1048470/+merge/123480

This fixes handling of non-unicode pageids, which were stored OK in the
DB, but broke HTML report rendering.
-- 
https://code.launchpad.net/~lifeless/python-oops-tools/bug-1048470/+merge/123480
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~lifeless/python-oops-tools/bug-1048470 into lp:python-oops-tools.
=== modified file 'src/oopstools/NEWS.txt'
--- src/oopstools/NEWS.txt	2012-07-27 04:27:53 +0000
+++ src/oopstools/NEWS.txt	2012-09-10 05:30:26 +0000
@@ -8,6 +8,9 @@
 * Reports have a per-report email address that can be set, to allow different
   reports to go to different addresses. (Robert Collins)
 
+* HTML reports can be created for non-ascii OOPS topics.
+  (Robert Collins, #1048470)
+
 0.6.2
 =====
 

=== modified file 'src/oopstools/oops/dbsummaries.py'
--- src/oopstools/oops/dbsummaries.py	2011-12-15 12:38:18 +0000
+++ src/oopstools/oops/dbsummaries.py	2012-09-10 05:30:26 +0000
@@ -134,6 +134,7 @@
                 data['pageid'] = 'Unknown'
             if data['pageid'] == '':
                 data['pageid'] = 'Unknown'
+            data['pageid'] = _escape(data['pageid'])
             data['escaped_url'] = _escape(data['url'])
             data['errors'] = data['errors'].split(',')
             data['errors'].sort()
@@ -457,7 +458,8 @@
             fp.write('<td>%s</td>\n<td><a href="%s">%s</a></td>'
                      '\n<td>%s</td>\n' % (
                         self.field_format % value,
-                        get_absolute_url(oopsids[0]), oopsids[0], pageid))
+                        get_absolute_url(oopsids[0]), oopsids[0].encode('utf8'),
+                        _escape(pageid)))
             fp.write('</tr>\n')
         fp.write('</table>')
         fp.write('</div>')

=== modified file 'src/oopstools/oops/test/test_dbsummaries.py'
--- src/oopstools/oops/test/test_dbsummaries.py	2011-12-13 15:10:47 +0000
+++ src/oopstools/oops/test/test_dbsummaries.py	2012-09-10 05:30:26 +0000
@@ -36,6 +36,7 @@
             'type': 'Exception',
             'value': u'a unicode char (\xa7)',
             'time': datetime(2008, 1, 13, 23, 14, 23, 00, utc),
+            'topic': u'more unicode \xa7',
             }
         ignored = parsed_oops_to_model_oops(
             python_oops, 'test_unicode_handling')
@@ -53,3 +54,4 @@
         fp = StringIO()
         self.summary.renderHTML(fp)
         self.assertThat(fp.getvalue(), Contains('a unicode char (\xc2\xa7)'))
+        self.assertThat(fp.getvalue(), Contains('more unicode \xc2\xa7'))