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).
|
|
3691.197.49
by Francis J. Lacoste
Add expire-tickets.py script |
5 |
|
4935.3.7
by Curtis Hovey
Added bad name suppression to cronscripts. |
6 |
# pylint: disable-msg=C0103,W0403
|
3691.197.49
by Francis J. Lacoste
Add expire-tickets.py script |
7 |
|
3691.398.19
by Francis J. Lacoste
Rename most remaining classes (views, database, authorizations, notifications, scripts.) |
8 |
""" Expire all questions in the OPEN and NEEDSINFO states that didn't receive
|
9 |
any activity in the last X days.
|
|
3691.197.49
by Francis J. Lacoste
Add expire-tickets.py script |
10 |
|
11 |
The expiration period is configured through
|
|
3691.398.24
by Francis J. Lacoste
Rename config section. |
12 |
config.answertracker.days_before_expiration
|
3691.197.49
by Francis J. Lacoste
Add expire-tickets.py script |
13 |
"""
|
14 |
||
15 |
__metaclass__ = type |
|
16 |
||
4621.5.19
by Curtis Hovey
Revisions per review. |
17 |
__all__ = ['ExpireQuestions'] |
18 |
||
19 |
||
3691.197.49
by Francis J. Lacoste
Add expire-tickets.py script |
20 |
import _pythonpath |
21 |
||
14612.2.8
by William Grant
cronscripts |
22 |
from lp.answers.scripts.questionexpiration import QuestionJanitor |
14605.1.1
by Curtis Hovey
Moved canonical.config to lp.services. |
23 |
from lp.services.config import config |
8356.1.1
by Leonard Richardson
Partial move. |
24 |
from lp.services.scripts.base import LaunchpadCronScript |
3691.398.19
by Francis J. Lacoste
Rename most remaining classes (views, database, authorizations, notifications, scripts.) |
25 |
|
26 |
||
4264.2.1
by James Henstridge
add a LaunchpadCronScript subclass, and make cronscripts/*.py use it |
27 |
class ExpireQuestions(LaunchpadCronScript): |
4621.5.10
by Curtis Hovey
Refactored the findExpirableBugTasks method to return a list of |
28 |
"""Expire old questions.
|
29 |
||
3691.398.19
by Francis J. Lacoste
Rename most remaining classes (views, database, authorizations, notifications, scripts.) |
30 |
This script expires questions in the OPEN and NEEDSINFO states that
|
3691.348.13
by kiko
Convert a couple of cronscripts over to LaunchpadScript |
31 |
didn't have any activity in the last X days. The number of days is
|
3691.398.24
by Francis J. Lacoste
Rename config section. |
32 |
configured through config.answertracker.days_before_expiration.
|
3691.348.13
by kiko
Convert a couple of cronscripts over to LaunchpadScript |
33 |
"""
|
4621.5.10
by Curtis Hovey
Refactored the findExpirableBugTasks method to return a list of |
34 |
usage = "usage: %prog [options]" |
35 |
description = __doc__ |
|
36 |
||
3691.348.13
by kiko
Convert a couple of cronscripts over to LaunchpadScript |
37 |
|
38 |
def main(self): |
|
4621.5.10
by Curtis Hovey
Refactored the findExpirableBugTasks method to return a list of |
39 |
"""Expire old questions."""
|
3691.398.19
by Francis J. Lacoste
Rename most remaining classes (views, database, authorizations, notifications, scripts.) |
40 |
janitor = QuestionJanitor(log=self.logger) |
3691.398.20
by Francis J. Lacoste
Rename all methods. |
41 |
janitor.expireQuestions(self.txn) |
3691.197.49
by Francis J. Lacoste
Add expire-tickets.py script |
42 |
|
43 |
||
44 |
if __name__ == '__main__': |
|
3691.398.19
by Francis J. Lacoste
Rename most remaining classes (views, database, authorizations, notifications, scripts.) |
45 |
script = ExpireQuestions('expire-questions', |
3691.398.24
by Francis J. Lacoste
Rename config section. |
46 |
dbuser=config.answertracker.dbuser) |
3691.348.13
by kiko
Convert a couple of cronscripts over to LaunchpadScript |
47 |
script.lock_and_run() |
48 |