~launchpad-pqm/launchpad/devel

10637.3.7 by Guilherme Salgado
merge devel
1
#!/usr/bin/python -S
8687.15.9 by Karl Fogel
Add the copyright header block to more files (everything under database/).
2
#
11626.3.17 by Curtis Hovey
Updated copyright.
3
# Copyright 2009-2010 Canonical Ltd.  This software is licensed under the
8687.15.9 by Karl Fogel
Add the copyright header block to more files (everything under database/).
4
# GNU Affero General Public License version 3 (see the file LICENSE).
5
5642.3.7 by Graham Binns
Review fixes for Barry.
6
"""Creates the GNU Savannah bugtracker celebrity.
5642.3.3 by Graham Binns
Added a Savannah celebrity.
7
5642.3.7 by Graham Binns
Review fixes for Barry.
8
This script should only need to be run once on production or staging. It
9
creates the records needed for the savannah_tracker LaunchpadCelebrity.
10
"""
5642.3.3 by Graham Binns
Added a Savannah celebrity.
11
12
import _pythonpath
13
14
from zope.component import getUtility
15
16
from canonical.lp import initZopeless
13130.1.22 by Curtis Hovey
Fixed db imports.
17
from lp.app.interfaces.launchpad import ILaunchpadCelebrities
10409.5.68 by Curtis Hovey
Removed the globs imports from scripts.
18
from lp.bugs.interfaces.bugtracker import (
11626.3.12 by Curtis Hovey
Cross fingers and toes and hope for the best--remove all glob imports of bugs from
19
    BugTrackerType,
20
    IBugTrackerAliasSet,
21
    IBugTrackerSet,
22
    )
23
from lp.bugs.model.bugtracker import BugTrackerAlias
14612.2.9 by William Grant
Other bits and pieces.
24
from lp.services.scripts import execute_zcml_for_scripts
5642.3.3 by Graham Binns
Added a Savannah celebrity.
25
26
27
execute_zcml_for_scripts()
28
ztm = initZopeless(implicitBegin=False)
29
ztm.begin()
30
31
bugtracker_set = getUtility(IBugTrackerSet)
32
admin_team = getUtility(ILaunchpadCelebrities).admin
33
savannah = bugtracker_set.getByName('savannah')
34
if savannah is None:
35
    savannah = bugtracker_set.ensureBugTracker(
5642.3.17 by Graham Binns
Fixed sampledata errors.
36
        'http://savannah.gnu.org/', admin_team, BugTrackerType.SAVANNAH,
5642.3.3 by Graham Binns
Added a Savannah celebrity.
37
        "GNU Savannah Bug Tracker", "Savannah is an open source software "
38
        "development hosting service based on SourceForge.",
39
        name='savannah')
40
    print "Created Savannah bug tracker."
41
else:
42
    print "Savannah bug tracker already exists."
43
44
bugtrackeralias_set = getUtility(IBugTrackerAliasSet)
45
if not bugtrackeralias_set.queryByBugTracker(savannah):
46
    savannah_alias = BugTrackerAlias(bugtracker=savannah,
5642.3.17 by Graham Binns
Fixed sampledata errors.
47
        base_url='http://savannah.nognu.org/')
5642.3.3 by Graham Binns
Added a Savannah celebrity.
48
    print "Created NoGNU alias for Savannah tracker."
49
else:
50
    print "NoGNU alias for Savannah already exists."
51
52
ztm.commit()