Merge lp:~jcsackett/launchpad/email-authentication-type-error into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Curtis Hovey on 2012-10-24 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 16190 |
| Proposed branch: | lp:~jcsackett/launchpad/email-authentication-type-error |
| Merge into: | lp:launchpad |
| Diff against target: |
32 lines (+11/-1) 2 files modified
lib/lp/services/mail/incoming.py (+5/-1) lib/lp/services/mail/tests/test_incoming.py (+6/-0) |
| To merge this branch: | bzr merge lp:~jcsackett/launchpad/email-authentication-type-error |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Curtis Hovey (community) | code | 2012-10-24 | Approve on 2012-10-24 |
|
Review via email:
|
|||
Commit Message
Updates authenticateEmail to gracefully handle TypeErrors from badly formed email addresses.
Description of the Change
Summary
=======
authenticateEmail crashes on bad email address (e.g. ones that are not pure
unicode but also not US-ASCII). While we can't process them, we shouldn't
crash either.
The better approach is to simply proceed without having been able to
authenticate, and set an anauthenticated principal as we do with unknown
emails.
Implementation
==============
The call in `authenticateEmail` to `getPrincipalBy
try/except block, which handles `TypeError` by setting principal to None. A
principal of None is a case which the rest of the code already handles
gracefully.
Tests
=====
bin/test -vvct test_badly_
QA
==
Using testemail.py (Curtis Hovey's script), contrive an email that has the right properties, and ensure it doesn't cause an OOPS.
LoC
===
I have approx 400 LoC credit.
Lint
====
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/

Thank you.
I have a script (testemail.py) I use to send "volleys" of emails at Lp. We might be able to use to to contrive the example address in the bug.