Use the same construction as pull-debian-source

This commit is contained in:
Stefano Rivera 2012-10-17 22:15:50 +02:00
parent 586197d591
commit 0adca3f7a1
2 changed files with 4 additions and 4 deletions

View File

@ -58,16 +58,15 @@ def source_package_for(binary, release):
Logger.warn(e)
url = ('http://dde.debian.net/dde/q/udd/dist/d:debian/r:%s/p:%s/?t=json'
% (release, binary))
data = None
try:
data = json.load(urllib2.urlopen(url))['r']
except urllib2.URLError, e:
Logger.error('Unable to retrieve package information from DDE: '
'%s (%s)', url, str(e))
return None
except ValueError, e:
Logger.error('Unable to parse JSON response from DDE: '
'%s (%s)', url, str(e))
return None
if not data:
return None
return data[0]['source']

View File

@ -53,8 +53,9 @@ def source_package_for(binary, release):
except urllib2.URLError, e:
Logger.error('Unable to retrieve package information from DDE: '
'%s (%s)', url, str(e))
except ValueError:
Logger.error('Unable to parse the response from DDE.')
except ValueError, e:
Logger.error('Unable to parse JSON response from DDE: '
'%s (%s)', url, str(e))
if not data:
return None
return data[0]['source']