Merge lp:~gz/python-oops-tools/dbsummaries_utf8_encode_891186 into lp:python-oops-tools
Proposed by
Martin Packman
Status: | Merged |
---|---|
Approved by: | Graham Binns |
Approved revision: | 31 |
Merged at revision: | 29 |
Proposed branch: | lp:~gz/python-oops-tools/dbsummaries_utf8_encode_891186 |
Merge into: | lp:python-oops-tools |
Diff against target: |
103 lines (+62/-7) 3 files modified
src/oopstools/oops/dbsummaries.py (+7/-0) src/oopstools/oops/test/test_dbsummaries.py (+55/-0) src/oopstools/scripts/analyse_error_reports.py (+0/-7) |
To merge this branch: | bzr merge lp:~gz/python-oops-tools/dbsummaries_utf8_encode_891186 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Graham Binns (community) | code | Approve | |
Review via email:
|
Commit message
Encode output of analyse_
Description of the change
There doesn't seem any need to hold off on this bug, so this branch merges Diogo's test and gets it working then applies a version of the fix I hope is acceptable to everyone. As we're not convinced that non-ascii byte strings can't be passed to the _escape function, cope with them by doing some gentle mangling to ascii. This ensures the output is well encoded but should give enough feedback if there are issues.
Is there anything else that's required? It's possible that some more _escape() calls need adding around some of the output, but this should be enough to resolve the bug as filed.
To post a comment you must log in.
Hi Martin,
This change looks good to me. A couple of cosmetic comments, though. The branch is good to land once you've fixed these:
[1]
61 + python_oops = {'id': 'OOPS-1234S101', 'reporter': 'edge',
62 + 'type': 'Exception', 'value': u'a unicode char (\xa7)',
63 + 'time': datetime(2008, 1, 13, 23, 14, 23, 00, utc)}
The formatting here's a bit dense. Dicts should be one element per line:
python_oops = {
'reporter' : 'edge',
'value' : u'a unicode char (\xa7)',
'id': 'OOPS-1234S101',
'type': 'Exception',
'time': datetime(2008, 1, 13, 23, 14, 23, 00, utc),
}
74 + def test_renderHTML _with_unicode_ data(self) :
75 + # Using cStringIO here to simulate a file object open without an
76 + # encoding specified.
This comment should state the expected behaviour rather than saying what
the test does. (Saves lazy developers from reading the code unless the
thing breaks.)