| 50 | | soup = BeautifulSoup(f).body.contents[5].div.div |
| 51 | | title = soup.h1.contents[0] |
| 52 | | tbody = soup.findAll('tbody')[0].findAll('td') |
| 53 | | product = tbody[0].a.contents[0] |
| 54 | | status = tbody[1].contents[0] |
| 55 | | importance = tbody[2].contents[0] |
| 56 | | #need to prettify assigned |
| 57 | | #assigned = tbody[3].a.contents[2] |
| 58 | | assigned = "Assigned to..." |
| 59 | | #need to prettify content |
| 60 | | content='' |
| 61 | | p = soup.findAll('div', recursive=0)[1].div.findAll('p', recursive=0) |
| 62 | | for i in p: |
| 63 | | for j in i.contents: |
| 64 | | jj = j.string |
| 65 | | # we get rid of <br /> tags |
| 66 | | if jj != None and jj != "<br />" : |
| 67 | | # here we remove manually all   |
| 68 | | newj = jj.strip().replace(" "," ") |
| 69 | | content = "%s\n%s"%(content,newj) |
| 70 | | content = "%s\n"%content |
| 71 | | |
| 72 | | zebug.setTitle(title) |
| 73 | | zebug.setStatus(status) |
| 74 | | zebug.setPackage(product) |
| 75 | | zebug.setImportance(importance) |
| 76 | | zebug.setDescription(content) |
| 77 | | |
| 78 | | array_com = soup.findAll('div', recursive=0)[1].findAll('div','boardComment') |
| 79 | | j = 0 |
| 80 | | com_counter = 0 |
| 81 | | for i in array_com : |
| 82 | | details = i.contents[1].findAll('a') |
| 83 | | title = details[0].strong.contents[0] |
| 84 | | poster = details[1].contents[0] |
| 85 | | body = i.contents[3].findAll('p') |
| 86 | | com_counter += 1 |
| 87 | | content="" |
| 88 | | for z in body : |
| 89 | | phrase = z.contents[0].string |
| 90 | | new_phrase = phrase.strip().replace(" "," ") |
| 91 | | content = "%s\n%s" %(content,new_phrase) |
| 92 | | newcom = comment(com_counter,content,poster,title,"00/00/00") |
| 93 | | zebug.addComment(newcom) |
| | 53 | soup1 = BeautifulSoup(f).body.contents[5] |
| | 54 | # no bug of this number here |
| | 55 | if soup1.div.h1.contents[0] == "Page not found" : |
| | 56 | # a negative number means that the bug doesn't exist |
| | 57 | zebug.setNbr(-1) |
| | 58 | else : |
| | 59 | soup = soup1.div.div |
| | 60 | title = soup.h1.contents[0] |
| | 61 | tbody = soup.findAll('tbody')[0].findAll('td') |
| | 62 | product = tbody[0].a.contents[0] |
| | 63 | status = tbody[1].contents[0] |
| | 64 | importance = tbody[2].contents[0] |
| | 65 | #need to prettify assigned |
| | 66 | #assigned = tbody[3].a.contents[2] |
| | 67 | assigned = "Assigned to..." |
| | 68 | #need to prettify content |
| | 69 | content='' |
| | 70 | p = soup.findAll('div', recursive=0)[1].div.findAll('p', recursive=0) |
| | 71 | for i in p: |
| | 72 | for j in i.contents: |
| | 73 | jj = j.string |
| | 74 | # we get rid of <br /> tags |
| | 75 | if jj != None and jj != "<br />" : |
| | 76 | # here we remove manually all   |
| | 77 | newj = jj.strip().replace(" "," ") |
| | 78 | content = "%s\n%s"%(content,newj) |
| | 79 | content = "%s\n"%content |
| | 80 | |
| | 81 | zebug.setTitle(title) |
| | 82 | zebug.setStatus(status) |
| | 83 | zebug.setPackage(product) |
| | 84 | zebug.setImportance(importance) |
| | 85 | zebug.setDescription(content) |
| | 86 | |
| | 87 | array_com = soup.findAll('div', recursive=0)[1].findAll('div','boardComment') |
| | 88 | j = 0 |
| | 89 | com_counter = 0 |
| | 90 | for i in array_com : |
| | 91 | details = i.contents[1].findAll('a') |
| | 92 | title = details[0].strong.contents[0] |
| | 93 | poster = details[1].contents[0] |
| | 94 | body = i.contents[3].findAll('p') |
| | 95 | com_counter += 1 |
| | 96 | content="" |
| | 97 | for z in body : |
| | 98 | phrase = z.contents[0].string |
| | 99 | new_phrase = phrase.strip().replace(" "," ") |
| | 100 | content = "%s\n%s" %(content,new_phrase) |
| | 101 | newcom = comment(com_counter,content,poster,title,"00/00/00") |
| | 102 | zebug.addComment(newcom) |
| 127 | | table = content.body.findAll('tbody')[1].findAll('tr') |
| 128 | | for tr in table : |
| 129 | | row = tr.findAll('td') |
| 130 | | nbr = int(row[1].contents[0]) |
| 131 | | title = row[2].a.contents[0] |
| 132 | | if typeofsearch == 2 : |
| 133 | | package = row[3].contents[0] |
| 134 | | importance = row[4].contents[0] |
| 135 | | status = row[5].contents[0] |
| 136 | | elif typeofsearch == 3 : |
| 137 | | package = arg_package |
| 138 | | importance = row[3].contents[0] |
| 139 | | status = row[4].contents[0] |
| 140 | | else : |
| 141 | | package = '' |
| 142 | | importance = '' |
| 143 | | status = '' |
| 144 | | results.insert_before(None, [nbr, package, title, importance, status ]) |
| 145 | | return results |
| | 140 | parse = content.body.findAll('tbody') |
| | 141 | # if no results |
| | 142 | if len(parse) == 0 : |
| | 143 | return results |
| | 144 | else : |
| | 145 | table = parse[1].findAll('tr') |
| | 146 | for tr in table : |
| | 147 | row = tr.findAll('td') |
| | 148 | nbr = int(row[1].contents[0]) |
| | 149 | title = row[2].a.contents[0] |
| | 150 | if typeofsearch == 2 : |
| | 151 | package = row[3].contents[0] |
| | 152 | importance = row[4].contents[0] |
| | 153 | status = row[5].contents[0] |
| | 154 | elif typeofsearch == 3 : |
| | 155 | package = arg_package |
| | 156 | importance = row[3].contents[0] |
| | 157 | status = row[4].contents[0] |
| | 158 | else : |
| | 159 | package = '' |
| | 160 | importance = '' |
| | 161 | status = '' |
| | 162 | results.insert_before(None, [nbr, package, title, importance, status ]) |
| | 163 | return results |