Commit 937a7dee authored by Daniel Holth's avatar Daniel Holth

package_index.py : fix hash_name

parent 70067439
......@@ -222,7 +222,8 @@ class HashChecker(ContentChecker):
)
def __init__(self, hash_name, expected):
self.hash = hashlib.new(hash_name)
self.hash_name = hash_name
self.hash = hashlib.new(hash_name)
self.expected = expected
@classmethod
......@@ -242,23 +243,8 @@ class HashChecker(ContentChecker):
def is_valid(self):
return self.hash.hexdigest() == self.expected
def _get_hash_name(self):
"""
Python 2.4 implementation of MD5 doesn't supply a .name attribute
so provide that name.
When Python 2.4 is no longer required, replace invocations of this
method with simply 'self.hash.name'.
"""
try:
return self.hash.name
except AttributeError:
if 'md5' in str(type(self.hash)):
return 'md5'
raise
def report(self, reporter, template):
msg = template % self._get_hash_name()
msg = template % self.hash_name
return reporter(msg)
......
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