Commit e5cb0d8e authored by Nicolas Dumazet's avatar Nicolas Dumazet

Simplify Pdata walk


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35291 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3cd40639
...@@ -44,18 +44,15 @@ def makeSortedTuple(kw): ...@@ -44,18 +44,15 @@ def makeSortedTuple(kw):
items.sort() items.sort()
return tuple(items) return tuple(items)
def hashPdataObject(data): def hashPdataObject(pdata_object):
"""Pdata objects are iterable, use this feature strongly """Pdata objects are iterable, use this feature strongly
to minimize memory footprint. to minimize memory footprint.
""" """
md5_hash = md5.new() md5_hash = md5.new()
next = chunk = data.next next = pdata_object
if next is None:
md5_hash.update(data.data)
while next is not None: while next is not None:
chunk = next md5_hash.update(next.data)
md5_hash.update(chunk) next = next.next
next = data.next
return md5_hash.hexdigest() return md5_hash.hexdigest()
class CachedConvertableMixin: class CachedConvertableMixin:
......
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