stringio does not have a fastread...
This commit is contained in:
parent
dfa9eff725
commit
0694a2e8c7
1 changed files with 8 additions and 2 deletions
|
@ -48,10 +48,16 @@ class MyKey(Key):
|
||||||
@return: MD5 Hash of the file in fp
|
@return: MD5 Hash of the file in fp
|
||||||
"""
|
"""
|
||||||
m = md5.new()
|
m = md5.new()
|
||||||
|
try:
|
||||||
s = fp.fastread(self.BufferSize)
|
s = fp.fastread(self.BufferSize)
|
||||||
|
except AttributeError:
|
||||||
|
s = fp.read(self.BufferSize)
|
||||||
while s:
|
while s:
|
||||||
m.update(s)
|
m.update(s)
|
||||||
|
try:
|
||||||
s = fp.fastread(self.BufferSize)
|
s = fp.fastread(self.BufferSize)
|
||||||
|
except AttributeError:
|
||||||
|
s = fp.read(self.BufferSize)
|
||||||
self.md5 = m.hexdigest()
|
self.md5 = m.hexdigest()
|
||||||
self.base64md5 = base64.encodestring(m.digest())
|
self.base64md5 = base64.encodestring(m.digest())
|
||||||
if self.base64md5[-1] == '\n':
|
if self.base64md5[-1] == '\n':
|
||||||
|
|
Loading…
Reference in a new issue