launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #05104
[Merge] lp:~danilo/launchpad/bug-847485 into lp:launchpad
Данило Шеган has proposed merging lp:~danilo/launchpad/bug-847485 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #847485 in Launchpad itself: "process-mail.py crashing with Unicode logging errors"
https://bugs.launchpad.net/launchpad/+bug/847485
For more details, see:
https://code.launchpad.net/~danilo/launchpad/bug-847485/+merge/77142
= Bug 847485 =
We lose a log message and get noise (an ignored traceback) in the log file since we are trying to print out unicode object with %s. Other log calls in the same file are using %r so I switch to that.
No tests provided, and none should be affected.
Most of the changes are lint fixes, actual code change is just a single line change.
== Tests ==
bin/test -cvvt incoming
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/services/mail/incoming.py
--
https://code.launchpad.net/~danilo/launchpad/bug-847485/+merge/77142
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~danilo/launchpad/bug-847485 into lp:launchpad.
=== modified file 'lib/lp/services/mail/incoming.py'
--- lib/lp/services/mail/incoming.py 2011-09-15 04:49:44 +0000
+++ lib/lp/services/mail/incoming.py 2011-09-27 11:16:46 +0000
@@ -126,10 +126,10 @@
dkim_log = cStringIO()
log.info(
- 'Attempting DKIM authentication of message id=%s from=%s sender=%s'
+ 'Attempting DKIM authentication of message id=%r from=%r sender=%r'
% (signed_message['Message-ID'],
- signed_message['From'],
- signed_message['Sender']))
+ signed_message['From'],
+ signed_message['Sender']))
signing_details = []
try:
# NB: if this fails with a keyword argument error, you need the
@@ -161,12 +161,14 @@
% (signing_domain,))
return None
for origin in ['From', 'Sender']:
- if signed_message[origin] is None: continue
+ if signed_message[origin] is None:
+ continue
name, addr = parseaddr(signed_message[origin])
try:
origin_domain = addr.split('@')[1]
except IndexError:
- log.warning("couldn't extract domain from address %r" % signed_message[origin])
+ log.warning("couldn't extract domain from address %r" % (
+ signed_message[origin]))
if signing_domain == origin_domain:
log.info(
"DKIM signing domain %s matches %s address %r"
@@ -203,10 +205,9 @@
# authenticator for this mail.
log.debug('trusted DKIM mail from %s' % dkim_trusted_addr)
email_addr = dkim_trusted_addr
- else:
+ else:
email_addr = parseaddr(mail['From'])[1]
- signature = mail.signature
authutil = getUtility(IPlacelessAuthUtility)
principal = authutil.getPrincipalByLogin(email_addr)
@@ -236,11 +237,12 @@
signature_timestamp_checker)
-def _gpgAuthenticateEmail(mail, principal, person, signature_timestamp_checker):
+def _gpgAuthenticateEmail(mail, principal, person,
+ signature_timestamp_checker):
"""Check GPG signature.
- :param principal: Claimed sender of the mail; to be checked against the actual
- signature.
+ :param principal: Claimed sender of the mail; to be checked against
+ the actual signature.
:returns: principal, either strongly or weakly authenticated.
"""
log = logging.getLogger('process-mail')
Follow ups