~launchpad-pqm/launchpad/devel

11946.1.1 by Danilo Segan
Add migration script for deriving is_imported flag from is_current flag for upstream projects.
1
#!/usr/bin/python -S
2
#
3
# Copyright 2010 Canonical Ltd.  This software is licensed under the
4
# GNU Affero General Public License version 3 (see the file LICENSE).
5
6
"""Migrate current flag to imported flag on project translations."""
7
8
import _pythonpath
9
10
from lp.services.scripts.base import LaunchpadScript
11
from lp.translations.scripts.migrate_current_flag import (
12
    MigrateCurrentFlagProcess)
13
14
15
class MigrateTranslationFlags(LaunchpadScript):
7675.916.98 by Henning Eggers
Merged db-stable at r10026 (recife roll-back) but without accepting the changes.
16
    """Go through translations for projects and set is_current_upstream flag
17
 
18
    Sets the is_current_upstream flag for all current translations in projects
19
    so that they appear as current in the new model.
11946.1.1 by Danilo Segan
Add migration script for deriving is_imported flag from is_current flag for upstream projects.
20
    """
21
22
    def main(self):
23
        fixer = MigrateCurrentFlagProcess(self.txn, self.logger)
24
        fixer.run()
25
26
27
if __name__ == '__main__':
28
    script = MigrateTranslationFlags(
29
        name="migratecurrentflag", dbuser='rosettaadmin')
30
    script.lock_and_run()