~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
#
14027.3.2 by Jeroen Vermeulen
Merge devel, resolve conflicts.
3
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
8687.15.7 by Karl Fogel
Add the copyright header block to more files.
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
1845 by Canonical.com Patch Queue Manager
translation file downloading backend [r=Salgado]
7
2125 by Canonical.com Patch Queue Manager
[r=bjornt] Cronscript refactorings
8
import _pythonpath
9
14600.2.2 by Curtis Hovey
Moved webapp to lp.services.
10
from lp.services.webapp.dbpolicy import SlaveDatabasePolicy
14027.3.2 by Jeroen Vermeulen
Merge devel, resolve conflicts.
11
from lp.services.scripts.base import LaunchpadCronScript
8751.1.1 by Danilo Šegan
Store migration changes so far.
12
from lp.translations.scripts.po_export_queue import process_queue
4264.2.1 by James Henstridge
add a LaunchpadCronScript subclass, and make cronscripts/*.py use it
13
14
15
class RosettaExportQueue(LaunchpadCronScript):
12189.3.1 by Jeroen Vermeulen
Avoid long-running master transactions during translations export.
16
    """Translation exports."""
17
3691.348.18 by kiko
Convert most other scripts; 6 remain, of which one looks like it's going to be a bit tricky...
18
    def main(self):
12189.3.1 by Jeroen Vermeulen
Avoid long-running master transactions during translations export.
19
        with SlaveDatabasePolicy():
20
            process_queue(self.txn, self.logger)
3691.348.18 by kiko
Convert most other scripts; 6 remain, of which one looks like it's going to be a bit tricky...
21
1845 by Canonical.com Patch Queue Manager
translation file downloading backend [r=Salgado]
22
23
if __name__ == '__main__':
3691.348.18 by kiko
Convert most other scripts; 6 remain, of which one looks like it's going to be a bit tricky...
24
    script = RosettaExportQueue('rosetta-export-queue', dbuser='poexport')
14022.3.2 by William Grant
LaunchpadScript no longer uses initZopeless.
25
    script.lock_and_run()