~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/services/mail/incoming.py

  • Committer: Jeroen Vermeulen
  • Date: 2011-09-26 06:30:07 UTC
  • mto: This revision was merged to the branch mainline in revision 14049.
  • Revision ID: jeroen.vermeulen@canonical.com-20110926063007-1fb5eelnidpnra9a
Fix lots of lint in recently-changed files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
161
161
            % (signing_domain,))
162
162
        return None
163
163
    for origin in ['From', 'Sender']:
164
 
        if signed_message[origin] is None: continue
 
164
        if signed_message[origin] is None:
 
165
            continue
165
166
        name, addr = parseaddr(signed_message[origin])
166
167
        try:
167
168
            origin_domain = addr.split('@')[1]
168
169
        except IndexError:
169
 
            log.warning("couldn't extract domain from address %r" % signed_message[origin])
 
170
            log.warning(
 
171
                "couldn't extract domain from address %r",
 
172
                signed_message[origin])
170
173
        if signing_domain == origin_domain:
171
174
            log.info(
172
 
                "DKIM signing domain %s matches %s address %r"
173
 
                % (signing_domain, origin, addr))
 
175
                "DKIM signing domain %s matches %s address %r",
 
176
                signing_domain, origin, addr)
174
177
            return addr
175
178
    else:
176
179
        log.info("DKIM signing domain %s doesn't match message origin; "
203
206
        # authenticator for this mail.
204
207
        log.debug('trusted DKIM mail from %s' % dkim_trusted_addr)
205
208
        email_addr = dkim_trusted_addr
206
 
    else:    
 
209
    else:
207
210
        email_addr = parseaddr(mail['From'])[1]
208
211
 
209
 
    signature = mail.signature
210
212
    authutil = getUtility(IPlacelessAuthUtility)
211
213
    principal = authutil.getPrincipalByLogin(email_addr)
212
214
 
236
238
            signature_timestamp_checker)
237
239
 
238
240
 
239
 
def _gpgAuthenticateEmail(mail, principal, person, signature_timestamp_checker):
 
241
def _gpgAuthenticateEmail(mail, principal, person,
 
242
                          signature_timestamp_checker):
240
243
    """Check GPG signature.
241
244
 
242
 
    :param principal: Claimed sender of the mail; to be checked against the actual
243
 
        signature.
 
245
    :param principal: Claimed sender of the mail; to be checked against the
 
246
        actual signature.
244
247
    :returns: principal, either strongly or weakly authenticated.
245
248
    """
246
249
    log = logging.getLogger('process-mail')