Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:fedora-infra/the-new-hotness int…
Browse files Browse the repository at this point in the history
…o develop
  • Loading branch information
ralphbean committed Sep 23, 2015
2 parents 1510b7a + 679254e commit 24b51ae
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions hotness/anitya.py
Expand Up @@ -249,8 +249,11 @@ def update_url(self, project, homepage):
response.status_code, data))
elif 'Could not' in response.text:
soup = bs4.BeautifulSoup(response.text, "lxml")
tag = soup.find_all(attrs={'class': 'error'})[0]
err = ' '.join(tag.stripped_strings)
err = 'Unknown error updating project in anitya'
# This is the css class on the error flash messages from anitya
tags = soup.find_all(attrs={'class': 'list-group-item-danger'})
if tags:
err = ' '.join(tags[0].stripped_strings)
raise AnityaException(err)

log.info('Successfully updated anitya url for %r' % data['name'])
Expand Down Expand Up @@ -297,9 +300,11 @@ def map_new_package(self, name, project):
response.status_code, data))
elif 'Could not' in response.text:
soup = bs4.BeautifulSoup(response.text, "lxml")
err = 'Unknown error mapping package in anitya'
# This is the css class on the error flash messages from anitya
tag = soup.find_all(attrs={'class': 'list-group-item-danger'})[0]
err = ' '.join(tag.stripped_strings)
tags = soup.find_all(attrs={'class': 'list-group-item-danger'})
if tags:
err = ' '.join(tags[0].stripped_strings)
raise AnityaException(err)

log.info('Successfully mapped %r in anitya' % name)
Expand Down Expand Up @@ -362,8 +367,11 @@ def add_new_project(self, name, homepage):
response.status_code, data))
elif 'Could not' in response.text:
soup = bs4.BeautifulSoup(response.text, "lxml")
tag = soup.find_all(attrs={'class': 'error'})[0]
err = ' '.join(tag.stripped_strings)
err = 'Unknown error adding project to anitya'
# This is the css class on the error flash messages from anitya
tags = soup.find_all(attrs={'class': 'list-group-item-danger'})
if tags:
err = ' '.join(tags[0].stripped_strings)
raise AnityaException(err)

log.info('Successfully added %r to anitya' % data['name'])

0 comments on commit 24b51ae

Please sign in to comment.