lab.nexedi.com will be down from Thursday, 20 March 2025, 07:30:00 UTC for a duration of approximately 2 hours

Commit 472d8db6 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

compare by str not by its md5 hash. this is faster in same case, and much faster in different case.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43844 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bb7019c0
......@@ -38,8 +38,6 @@ from OFS.Image import Pdata
import cStringIO
from Products.ERP5Type.Utils import deprecated
import md5
def _unpackData(data):
"""
Unpack Pdata into string
......@@ -141,10 +139,7 @@ class File(Document, CMFFile):
def _setFile(self, data, precondition=None):
if data is not None and self.hasData() and \
md5.md5(str(data.read())).digest() ==\
md5.md5(str(self.getData())).digest():
# Compute md5 hash only if there is something to hash on both sides.
#
str(data.read()) == str(self.getData()):
# Same data as previous, no need to change it's content
return
CMFFile._edit(self, precondition=precondition, file=data)
......
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