Merge lp:~sinzui/launchpad/oopsless-repr into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Eleanor Berger |
Approved revision: | no longer in the source branch. |
Merged at revision: | 10854 |
Proposed branch: | lp:~sinzui/launchpad/oopsless-repr |
Merge into: | lp:launchpad |
Diff against target: |
169 lines (+68/-10) 6 files modified
lib/canonical/launchpad/database/account.py (+2/-1) lib/canonical/launchpad/tests/test_account.py (+17/-0) lib/lp/registry/model/distribution.py (+4/-3) lib/lp/registry/model/person.py (+2/-2) lib/lp/registry/tests/test_distribution.py (+28/-4) lib/lp/registry/tests/test_person.py (+15/-0) |
To merge this branch: | bzr merge lp:~sinzui/launchpad/oopsless-repr |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Eleanor Berger (community) | code | Approve | |
Review via email: mp+24929@code.launchpad.net |
Description of the change
This is my branch to make __repr__ ascii safe for several classes.
lp:~sinzui/launchpad/oopsless-repr
Diff size: 169
Launchpad bug: https:/
Test command: ./bin/test -vv \
-t test_person_repr -t test_distributi
Pre-
Target release: 10.05
Make __repr__ ascii safe for several classes
-------
As seen on OOPS-1582EB1587 a UnicodeEncodeError was raised while GET'ing the
+reviewaccount page for a person and the person display name contains non-
ascii characters. The oops was created *after* the canonical_
raised its own error because henninge hacked the URL to non-existent person.
The error message wanted to tell henninge to be a good boy, but the
NoCanonicalUrl uses the __repr__ of the object, which for many launchpad
objects, will contain Unicode.
This affects the following models:
Account
Distribution
Person
Rules
-----
* Use use .encode('ASCII', 'backslashreplace') to make the displayname
safe.
QA
--
This is difficult to test since we only see this issue during oopses.
One oops that be reproduced is
* Visit https:/
* Verify the oops is not about:
UnicodeEn
* Verify the oops is about NoCanonicalUrl
Lint
----
Linting changed files:
lib/canonical
lib/canonical
lib/lp/
lib/lp/
lib/lp/
lib/lp/
Test
----
* lib/canonical/
Added tests for ANSI and Unicode __repr__
* lib/lp/
Added tests for ANSI and Unicode __repr__
* lib/lp/
Added tests for ANSI and Unicode __repr__
Implementation
--------------
* lib/canonical/
Escaped the displayname.
* lib/lp/
Escaped the displayname and fixed two lint issues.
* lib/lp/
Escaped the displayname.