~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
8523.3.1 by Gavin Panella
Bugs tree reorg after automated migration.
12
from lp.bugs.scripts.bugtasktargetnamecaches import (
14612.2.8 by William Grant
cronscripts
13
    BugTaskTargetNameCacheUpdater,
14
    )
14605.1.1 by Curtis Hovey
Moved canonical.config to lp.services.
15
from lp.services.config import config
14612.2.8 by William Grant
cronscripts
16
from lp.services.scripts.base import 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.
17
18
4264.2.1 by James Henstridge
add a LaunchpadCronScript subclass, and make cronscripts/*.py use it
19
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.
20
    """Update the targetnamecache for all IBugTasks.
21
3691.348.18 by kiko
Convert most other scripts; 6 remain, of which one looks like it's going to be a bit tricky...
22
    This ensures that the cache values are up-to-date even after, for
23
    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.
24
    """
3691.348.18 by kiko
Convert most other scripts; 6 remain, of which one looks like it's going to be a bit tricky...
25
    def main(self):
5781.3.2 by Graham Binns
Added tests.
26
        updater = BugTaskTargetNameCacheUpdater(self.txn, self.logger)
27
        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.
28
29
if __name__ == '__main__':
5781.3.3 by Graham Binns
Cleaned up lint.
30
    script = UpdateBugTaskTargetNameCaches(
31
        '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...
32
        dbuser=config.targetnamecacheupdater.dbuser)
12415.1.5 by William Grant
Purge implicit_begin/implicitBegin; ignored since Storm.
33
    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...
34