Commit a4084ddd authored by Łukasz Nowak's avatar Łukasz Nowak

Simplify.

parent ad6e4d5c
...@@ -165,23 +165,18 @@ class NetworkcacheClient(object): ...@@ -165,23 +165,18 @@ class NetworkcacheClient(object):
data = urllib2.urlopen(request).read() data = urllib2.urlopen(request).read()
# Filtering... # Filtering...
data_list = json.loads(data) data_list = json.loads(data)
if len(data_list) > 1 and not \
(self.signature_certificate_file_list or \
self.signature_certificate_url_list):
raise DirectoryNotFound('Too many entries for a given directory. ' \
'Directory: %s. Entries: %s.' % (urlmd5, str(data_list)))
if self.signature_certificate_file_list or \ if self.signature_certificate_file_list or \
self.signature_certificate_url_list: self.signature_certificate_url_list:
method = self._verifySignatureInCertificateList method = self._verifySignatureInCertificateList
data_list = filter(lambda x: method(x[1]), data_list) data_list = filter(lambda x: method(x[1]), data_list)
if len(data_list) > 1:
raise DirectoryNotFound('Too many entries for a given key. ' \
'Directory: %s. Entries: %s.' %(urlmd5, str(data_list)))
if not data_list: if not data_list:
raise DirectoryNotFound('Could not find a trustable entry.') raise DirectoryNotFound('Could not find a trustable entry.')
if len(data_list) > 1:
raise DirectoryNotFound('Too many entries for a given key. ' \
'Directory: %s. Entries: %s.' % (urlmd5, str(data_list)))
information_dict, signature = data_list[0] information_dict, signature = data_list[0]
sha512 = information_dict.get('sha512') sha512 = information_dict.get('sha512')
return self.download(sha512) return self.download(sha512)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment