Changeset 20 for launchpad_test.py
- Timestamp:
- 07/07/06 23:02:21 (3 years ago)
- Files:
-
- 1 modified
-
launchpad_test.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
launchpad_test.py
r18 r20 5 5 import gtk.glade 6 6 import urllib 7 from bug import bug7 from bug import * 8 8 from BeautifulSoup import BeautifulSoup 9 9 # You have to change this if you have another storage … … 11 11 12 12 13 zeurl="https://launchpad.net/ products/malone/+bug/1"13 zeurl="https://launchpad.net/bugs/51835" 14 14 f= urllib.urlopen(zeurl) 15 zebug = bug(42) 15 16 # ici on a le corps principal 16 17 # faudrait faire un extract pour soulager la mémoire … … 21 22 status = tbody[1].contents[0] 22 23 importance = tbody[2].contents[0] 23 assigned = tbody[3].a.contents[2]24 #print title25 #print product26 #print status27 #print importance24 #assigned = tbody[3].a.contents[2] 25 print title 26 print product 27 print status 28 print importance 28 29 #need to prettify assigned 29 30 #print assigned 30 content='' 31 p = soup.findAll('div', recursive=0)[1].div.findAll('p', recursive=0) 32 for i in p: 33 #print i.renderContents() 34 for j in i.contents: 35 jj = j.string 36 if jj != None and jj != "<br />" : 37 print "#############################" 38 newj = jj.strip().replace(" "," ") 39 print str(newj) 40 content = "%s\n%s"%(content,newj) 41 #print newj 42 #print j.renderContents() 43 #print "#####################" 44 content = "%s\n"%content 45 #print content 31 array_com = soup.findAll('div', recursive=0)[1].findAll('div','boardComment') 32 print array_com 33 j = 0 34 com_counter = 0 35 for i in array_com : 36 details = i.contents[1].findAll('a') 37 title = details[0].strong.contents[0] 38 poster = details[1].contents[0] 39 body = i.contents[3].findAll('p') 40 com_counter += 1 41 content="" 42 for z in body : 43 phrase = z.contents[0].string 44 new_phrase = phrase.strip().replace(" "," ") 45 content = "%s\n%s" %(content,new_phrase) 46 newcom = comment(com_counter,content,poster,title,"date not implemented") 47 zebug.addComment(newcom) 48 j += 1 49 print zebug.comNbr() 46 50 47 #p = soup.p48 #content = p.contents[0]49 #print p.name50 #p = p.next51 #print p52 #p = p.nextSibling.nextSibling53 #while p.name != 'form' :54 # print p.name55 # if p.name == 'p' :56 # content = content+'\n'+p.contents[0]57 # p = p.next58 #print content59 60
