~launchpad-pqm/launchpad/devel

10637.3.1 by Guilherme Salgado
Use the default python version instead of a hard-coded version
1
#!/usr/bin/python -S
8687.15.7 by Karl Fogel
Add the copyright header block to more files.
2
#
3
# Copyright 2009 Canonical Ltd.  This software is licensed under the
4
# GNU Affero General Public License version 3 (see the file LICENSE).
5
4935.3.7 by Curtis Hovey
Added bad name suppression to cronscripts.
6
# pylint: disable-msg=C0103,W0403
1872 by Canonical.com Patch Queue Manager
First cut of the email interface! Refactorings to SQLObjectFooEvents. First cut of banzai deeath scene. Fix bug 931. Add bug url declarations. And some more... r=stevea
7
"""Fetches mail from the mail box and feeds them to the handlers."""
8
2125 by Canonical.com Patch Queue Manager
[r=bjornt] Cronscript refactorings
9
import _pythonpath
10
7225.1.1 by Danilo Šegan
Fix #284665: do not use deprecated zope.component.exceptions, and instead use zope.component.interfaces to get ComponentLookupError.
11
from zope.component.interfaces import ComponentLookupError
1872 by Canonical.com Patch Queue Manager
First cut of the email interface! Refactorings to SQLObjectFooEvents. First cut of banzai deeath scene. Fix bug 931. Add bug url declarations. And some more... r=stevea
12
14605.1.1 by Curtis Hovey
Moved canonical.config to lp.services.
13
from lp.services.config import config
11678.2.5 by Gary Poster
move files as requested by review to lp/services; change things further as lint requests.
14
from lp.services.mail.incoming import handleMail
14538.2.51 by Curtis Hovey
Fixed import.
15
from lp.services.mail.mailbox import IMailBox
14612.2.8 by William Grant
cronscripts
16
from lp.services.scripts.base import (
17
    LaunchpadCronScript,
18
    LaunchpadScriptFailure,
19
    )
1872 by Canonical.com Patch Queue Manager
First cut of the email interface! Refactorings to SQLObjectFooEvents. First cut of banzai deeath scene. Fix bug 931. Add bug url declarations. And some more... r=stevea
20
4974.5.4 by Francis J. Lacoste
Make process-mail.py dbuser configurable.
21
4264.2.1 by James Henstridge
add a LaunchpadCronScript subclass, and make cronscripts/*.py use it
22
class ProcessMail(LaunchpadCronScript):
3691.348.18 by kiko
Convert most other scripts; 6 remain, of which one looks like it's going to be a bit tricky...
23
    usage = """%prog [options]
24
25
    """ + __doc__
11678.2.5 by Gary Poster
move files as requested by review to lp/services; change things further as lint requests.
26
3691.348.18 by kiko
Convert most other scripts; 6 remain, of which one looks like it's going to be a bit tricky...
27
    def main(self):
1872 by Canonical.com Patch Queue Manager
First cut of the email interface! Refactorings to SQLObjectFooEvents. First cut of banzai deeath scene. Fix bug 931. Add bug url declarations. And some more... r=stevea
28
        try:
3691.348.18 by kiko
Convert most other scripts; 6 remain, of which one looks like it's going to be a bit tricky...
29
            handleMail(self.txn)
1872 by Canonical.com Patch Queue Manager
First cut of the email interface! Refactorings to SQLObjectFooEvents. First cut of banzai deeath scene. Fix bug 931. Add bug url declarations. And some more... r=stevea
30
        except ComponentLookupError, lookup_error:
3691.348.18 by kiko
Convert most other scripts; 6 remain, of which one looks like it's going to be a bit tricky...
31
            if lookup_error.args[0] != IMailBox:
32
                raise
33
            raise LaunchpadScriptFailure(
34
                "No mail box is configured. "
35
                "Please see mailbox.txt for info on how to configure one.")
1872 by Canonical.com Patch Queue Manager
First cut of the email interface! Refactorings to SQLObjectFooEvents. First cut of banzai deeath scene. Fix bug 931. Add bug url declarations. And some more... r=stevea
36
37
38
if __name__ == '__main__':
4974.5.4 by Francis J. Lacoste
Make process-mail.py dbuser configurable.
39
    script = ProcessMail('process-mail', dbuser=config.processmail.dbuser)
3691.348.18 by kiko
Convert most other scripts; 6 remain, of which one looks like it's going to be a bit tricky...
40
    script.lock_and_run(use_web_security=True)