| 13 | | bugnbr="42" |
| 14 | | nbr=int(bugnbr) |
| 15 | | |
| 16 | | zebug = bug(nbr) |
| 17 | | |
| 18 | | zeurl="https://launchpad.net/products/malone/+bug/1" |
| 19 | | f= urllib.urlopen(zeurl) |
| 20 | | # ici on a le corps principal |
| 21 | | # faudrait faire un extract pour soulager la mémoire |
| 22 | | soup = BeautifulSoup(f).body.contents[5].div.div |
| 23 | | title = soup.h1.contents[0] |
| 24 | | tbody = soup.findAll('tbody')[0].findAll('td') |
| 25 | | product = tbody[0].a.contents[0] |
| 26 | | status = tbody[1].contents[0] |
| 27 | | importance = tbody[2].contents[0] |
| 28 | | assigned = tbody[3].a.contents[2] |
| 29 | | zebug.setTitle(title) |
| 30 | | zebug.setPackage(product) |
| 31 | | zebug.setStatus(status) |
| 32 | | zebug.setImportance(importance) |
| 33 | | zebug.setAssignee(assigned) |
| 34 | | #need to prettify assigned |
| 35 | | content='' |
| 36 | | p = soup.findAll('div', recursive=0)[1].div.findAll('p', recursive=0) |
| 37 | | for i in p: |
| 38 | | for j in i.contents: |
| 39 | | content = "%s\n%s"%(content,j) |
| 40 | | zebug.setDescription(content) |
| | 14 | bts = protocol() |
| | 15 | zebug = bts.retrieveBug(42) |
| | 16 | bugnbr = str(zebug.getNbr()) |
| | 43 | #inserting comments |
| | 44 | hbox = gtk.VBox(spacing=2) |
| | 45 | hbox.show() |
| | 46 | for i in zebug.getAllComments(): |
| | 47 | comwidget = gtk.glade.XML("comment.glade") |
| | 48 | comwidget.get_widget("poster").set_text(i.getAuthor()) |
| | 49 | comwidget.get_widget("title").set_text(i.getTitle()) |
| | 50 | comwidget.get_widget("date").set_text(i.getDate()) |
| | 51 | comwidget.get_widget("comment_body").set_text(i.getContent()) |
| | 52 | hbox.add(comwidget.get_widget("comment")) |
| | 53 | |
| | 54 | |
| | 55 | to_remove = bugwidget.get_widget("dummy_label") |
| | 56 | widget_comments.remove(to_remove) |
| | 57 | widget_comments.add(hbox) |
| | 58 | |