~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-08-02 23:44:26 UTC
  • mfrom: (13589.1.1 revert-r13574)
  • Revision ID: launchpad@pqm.canonical.com-20110802234426-z03j07sj334l9ay0
[r=wgrant][rollback=13574] Revert r13574. It crashes when the flag is
 enabled, see bug #810290.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
from canonical.launchpad.webapp.interfaces import IPlacelessAuthUtility
53
53
from canonical.librarian.interfaces import UploadFailed
54
54
from lp.registry.interfaces.person import IPerson
55
 
from lp.services.features import (
56
 
    getFeatureFlag,
57
 
    UseFeatureController,
58
 
    )
 
55
from lp.services.features import getFeatureFlag
59
56
from lp.services.mail.handlers import mail_handlers
60
57
from lp.services.mail.sendmail import do_paranoid_envelope_to_validation
61
58
from lp.services.mail.signedmessage import signed_message_from_string
62
59
 
63
 
from lp.services.features.flags import FeatureController
64
 
from lp.services.features.rulesource import StormFeatureRuleSource
65
 
from lp.services.features.scopes import ScopesForMail
66
 
 
67
 
 
68
60
# Match '\n' and '\r' line endings. That is, all '\r' that are not
69
61
# followed by a '\n', and all '\n' that are not preceded by a '\r'.
70
62
non_canonicalised_line_endings = re.compile('((?<!\r)\n)|(\r(?!\n))')
140
132
    signing_details = []
141
133
    try:
142
134
        # NB: if this fails with a keyword argument error, you need the
143
 
        # python-dkim 0.3-3.2 that adds it.
 
135
        # python-dkim 0.3-3.2 that adds it
144
136
        dkim_result = dkim.verify(
145
137
            signed_message.parsed_string, dkim_log, details=signing_details)
146
138
    except dkim.DKIMException, e:
328
320
    return request.oopsid
329
321
 
330
322
 
331
 
def mail_feature_controller(mail):
332
 
    return FeatureController(
333
 
        ScopesForMail(mail),
334
 
        StormFeatureRuleSource())
335
 
 
336
 
 
337
323
def handleMail(trans=transaction,
338
324
               signature_timestamp_checker=None):
339
325
 
374
360
                continue
375
361
            try:
376
362
                trans.begin()
377
 
                controller = mail_feature_controller(mail)
378
 
                with UseFeatureController(controller):
379
 
                    handle_one_mail(log, mail, file_alias, file_alias_url,
380
 
                        signature_timestamp_checker)
381
 
                    trans.commit()
382
 
                    mailbox.delete(mail_id)
383
 
                    log.debug(
384
 
                        "usedFlags=%r, usedScopes=%r" % (
385
 
                        controller.usedFlags(),
386
 
                        controller.usedScopes()))
 
363
                handle_one_mail(log, mail, file_alias, file_alias_url,
 
364
                    signature_timestamp_checker)
 
365
                trans.commit()
 
366
                mailbox.delete(mail_id)
387
367
            except (KeyboardInterrupt, SystemExit):
388
368
                raise
389
369
            except: