~rachidbm/ubuntu-l10n-tools/search

« back to all changes in this revision

Viewing changes to ul10n_tools/lp_set_pot_priority/__init__.py

  • Committer: David Planella
  • Date: 2011-05-26 11:08:04 UTC
  • Revision ID: david.planella@ubuntu.com-20110526110804-jixktqalpof57z5p
Added a README file with the tool descriptions and a new tool to set the priority of templates

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
# Sets the priorities of translatable templates in Launchpad according to the
 
4
# given CSV file.
 
5
#
 
6
# The list of templates and their priorities can be seen at:
 
7
#
 
8
#  https://translations.launchpad.net/ubuntu/natty/+templates
 
9
#
 
10
# (for the staging server)
 
11
 
 
12
# TODO: import the launchpadmanager module from ul10n_tools and use that
 
13
from launchpadlib.launchpad import Launchpad
 
14
 
 
15
def main():
 
16
    # TODO: make the Launchpad server ('production', 'staging') a command line option,
 
17
    # (e.g. --use-production) making the default 'staging'
 
18
    launchpad = Launchpad.login_with('Template priority setter', 'staging')
 
19
 
 
20
    # TODO: make the file name the argument to the program invokation
 
21
    template_list = open('natty-templates.csv').readlines()
 
22
 
 
23
    for line in template_list[1:]:
 
24
        # TODO: use the csv module for reading the file
 
25
        priority, sp, template = line.strip().split(',')
 
26
        pot = launchpad.load(
 
27
            # TODO: make the 'natty' part a command line option (e.g. --distro natty)
 
28
            'https://api.launchpad.net/1.0/ubuntu/natty/+source/' +
 
29
            sp + '/+pots/' + template)
 
30
        pot.priority = priority
 
31
        pot.lp_save()