~ubuntu-branches/ubuntu/precise/bughelper/precise

« back to all changes in this revision

Viewing changes to buginfo

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-08-23 16:16:51 UTC
  • Revision ID: james.westby@ubuntu.com-20070823161651-38cz13hfuw32aglc
Tags: 0.2
* Include Markus' API changes to make bughelper work with the new
  python-launchpad-bugs API. 
* Also includes the Bughelper Server, which will generate automatic reports
  for Bughelper Queries based on the cluefile data we have.
* Thanks a lot Markus and thanks also Google for making the Summer of Code
  possible.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
import sys
7
7
 
8
8
try: 
9
 
    from HTMLOperations import Bug
 
9
    import connector as Connector
10
10
    from commandLine import commandLine
11
11
    import utils as utils
12
12
except:
13
13
    from bugHelper.commandLine import commandLine
14
 
    from launchpadBugs.HTMLOperations import Bug
 
14
    import launchpadbugs.connector as Connector
15
15
    import launchpadBugs.utils as utils
16
16
 
17
17
def main():
18
18
    cl = commandLine()
 
19
    
 
20
    Bug = Connector.ConnectBug()
 
21
    cookie = None
 
22
    try:
 
23
        cookie = cl.options.cookie
 
24
    except:
 
25
        try:
 
26
            cookie = os.path.expanduser(config.cookie)
 
27
        except:
 
28
            print >> sys.stderr, "No cookie-file found"
 
29
    if cookie:
 
30
        Bug.authentication=cookie
 
31
    
19
32
    if not cl.options.bugnr:
20
33
        cl.parser.print_usage()
21
34
        sys.exit(1)
22
35
 
23
 
    bug= Bug(cl.options.bugnr)
 
36
    bug= Bug(int(cl.options.bugnr))
24
37
 
25
38
    if cl.options.comments:
26
 
        comments = bug.Comments()
 
39
        comments = bug.comments
27
40
        print "Comments:", len(comments)
28
41
        print comments
29
42
    if cl.options.reporter:
30
 
        print bug.Reporter()
 
43
        print bug.reporter
31
44
    if cl.options.title:
32
 
        print bug.Title()
 
45
        print bug.title
33
46
    if cl.options.tags:
34
 
        print bug.Tags()
 
47
        print bug.tags
35
48
    if cl.options.countcomments:
36
 
        comments = bug.Comments()
 
49
        comments = bug.comments
37
50
        print len(comments)
38
51
    if cl.options.comment or cl.options.lastcomment:
39
 
        comments = comment = bug.Comments()
40
 
        if cl.options.lastcomment: 
41
 
            cl.options.comment = int(comment[len(comment)-1][0])
42
 
        comment = filter(lambda c: int(c[0])==cl.options.comment, comment)
 
52
        comments = bug.comments
 
53
        cnr = -1 if cl.options.lastcomment else cl.options.comment
 
54
        comment = comments[int(cnr)]
43
55
        if comment:
44
56
            if cl.options.author:
45
 
                print comment[0][1]
 
57
                print comment.user
46
58
            if cl.options.date:
47
 
                print comment[0][2]
 
59
                print comment.date
48
60
            if not cl.options.author and not cl.options.date:
49
 
                print comment[0]
 
61
                print comment
50
62
        elif cl.options.verbose:
51
63
            text = ''
52
64
            for c in comments:
53
 
                text += c[0] + ', '
 
65
                text += c.number + ', '
54
66
            print "available comments: %s" % text
55
67
 
56
68