~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
2770.1.4 by Guilherme Salgado
Change all bug reports on people's page to use the google-style lists and have search/sort widgets. Also adds a new targetnamecache column in the BugTask table to allow sorting/searching on that value. Plus *a lot* other cleanup.
7
8
# This script updates the cached stats in the system
9
10
import _pythonpath
11
8356.1.1 by Leonard Richardson
Partial move.
12
from lp.services.scripts.base import LaunchpadCronScript
8523.3.1 by Gavin Panella
Bugs tree reorg after automated migration.
13
from lp.bugs.scripts.bugtasktargetnamecaches import (
5781.3.2 by Graham Binns
Added tests.
14
    BugTaskTargetNameCacheUpdater)
2770.1.4 by Guilherme Salgado
Change all bug reports on people's page to use the google-style lists and have search/sort widgets. Also adds a new targetnamecache column in the BugTask table to allow sorting/searching on that value. Plus *a lot* other cleanup.
15
from canonical.config import config
16
17
4264.2.1 by James Henstridge
add a LaunchpadCronScript subclass, and make cronscripts/*.py use it
18
class UpdateBugTaskTargetNameCaches(LaunchpadCronScript):
2770.1.4 by Guilherme Salgado
Change all bug reports on people's page to use the google-style lists and have search/sort widgets. Also adds a new targetnamecache column in the BugTask table to allow sorting/searching on that value. Plus *a lot* other cleanup.
19
    """Update the targetnamecache for all IBugTasks.
20
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
    This ensures that the cache values are up-to-date even after, for
22
    example, an IDistribution being renamed.
2770.1.4 by Guilherme Salgado
Change all bug reports on people's page to use the google-style lists and have search/sort widgets. Also adds a new targetnamecache column in the BugTask table to allow sorting/searching on that value. Plus *a lot* other cleanup.
23
    """
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
    def main(self):
5781.3.2 by Graham Binns
Added tests.
25
        updater = BugTaskTargetNameCacheUpdater(self.txn, self.logger)
26
        updater.run()
2770.1.4 by Guilherme Salgado
Change all bug reports on people's page to use the google-style lists and have search/sort widgets. Also adds a new targetnamecache column in the BugTask table to allow sorting/searching on that value. Plus *a lot* other cleanup.
27
28
if __name__ == '__main__':
5781.3.3 by Graham Binns
Cleaned up lint.
29
    script = UpdateBugTaskTargetNameCaches(
30
        'launchpad-targetnamecacheupdater',
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
        dbuser=config.targetnamecacheupdater.dbuser)
12415.1.5 by William Grant
Purge implicit_begin/implicitBegin; ignored since Storm.
32
    script.lock_and_run()
3691.348.18 by kiko
Convert most other scripts; 6 remain, of which one looks like it's going to be a bit tricky...
33