~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).
4621.5.2 by Curtis Hovey
Added cronscripts/expire-bugtask.py
5
4935.3.7 by Curtis Hovey
Added bad name suppression to cronscripts.
6
# pylint: disable-msg=C0103,W0403
4621.5.2 by Curtis Hovey
Added cronscripts/expire-bugtask.py
7
8
"""Expire all old, Incomplete bugs tasks that are unassigned in Malone.
9
10
Only bug task for project that use Malone may be expired. The expiration
4621.5.4 by Curtis Hovey
Save point. Lots do do according to the bugtask-expiration.txt doctest.
11
period is configured through config.malone.days_before_expiration.
4621.5.2 by Curtis Hovey
Added cronscripts/expire-bugtask.py
12
"""
13
14
__metaclass__ = type
15
16
import _pythonpath
17
18
from canonical.config import config
8356.1.1 by Leonard Richardson
Partial move.
19
from lp.services.scripts.base import LaunchpadCronScript
8523.3.1 by Gavin Panella
Bugs tree reorg after automated migration.
20
from lp.bugs.scripts.bugexpire import BugJanitor
4621.5.2 by Curtis Hovey
Added cronscripts/expire-bugtask.py
21
22
23
class ExpireBugTasks(LaunchpadCronScript):
24
    """Expire all old, Incomplete bugs tasks that are unassigned in Malone.
25
4621.5.5 by Curtis Hovey
Basic functionality for expiring bugs is complete.
26
    Only bug task for project that use Malone may be automatically set to
27
    the status of Invalid (expired). The expiration period is configured
28
    through config.malone.days_before_expiration.
4621.5.2 by Curtis Hovey
Added cronscripts/expire-bugtask.py
29
    """
30
    usage = "usage: %prog [options]"
4621.5.4 by Curtis Hovey
Save point. Lots do do according to the bugtask-expiration.txt doctest.
31
    description =  '    %s' % __doc__
4621.5.2 by Curtis Hovey
Added cronscripts/expire-bugtask.py
32
33
    def main(self):
34
        """Run the BugJanitor."""
35
        janitor = BugJanitor(log=self.logger)
36
        janitor.expireBugTasks(self.txn)
37
38
39
if __name__ == '__main__':
40
    script = ExpireBugTasks(
4621.5.4 by Curtis Hovey
Save point. Lots do do according to the bugtask-expiration.txt doctest.
41
        'expire-bugtasks', dbuser=config.malone.expiration_dbuser)
4621.5.2 by Curtis Hovey
Added cronscripts/expire-bugtask.py
42
    script.lock_and_run()
43