~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to utilities/generate-external-bug-status-docs

  • Committer: Gavin Panella
  • Date: 2008-05-23 12:37:44 UTC
  • mto: This revision was merged to the branch mainline in revision 6498.
  • Revision ID: gavin.panella@canonical.com-20080523123744-l8rtspvgls9559a3
Add generation script.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python2.4
 
2
 
 
3
import _pythonpath
 
4
 
 
5
from canonical.launchpad.components.externalbugtracker import (
 
6
    BUG_TRACKER_CLASSES)
 
7
 
 
8
 
 
9
if __name__ == '__main__':
 
10
    classes = sorted(BUG_TRACKER_CLASSES.iteritems(),
 
11
                     key=lambda (typ, cls): typ.title)
 
12
 
 
13
    for typ, cls in classes:
 
14
        # Attempt to find a lookup instance.
 
15
        lookup = getattr(cls, '_status_lookup', None)
 
16
        if lookup is None:
 
17
            continue
 
18
 
 
19
        # Find or fabricate titles.
 
20
        titles = getattr(cls, '_status_lookup_titles', None)
 
21
        if titles is None:
 
22
            titles = ['Key %d' % (i + 1) for i in range(lookup.max_depth)]
 
23
        else:
 
24
            titles = list(titles)
 
25
        titles.append('Launchpad status')
 
26
 
 
27
        # Print it out.
 
28
        print '[[Anchor(%s)]]' % (typ.name,)
 
29
        print '== %s ==' % (typ.title,)
 
30
        print
 
31
        for line in lookup.moinmoin_table(titles):
 
32
            print line
 
33
        print
 
34
        print