[Erp5-report] r43844 kazuhiko - /erp5/trunk/products/ERP5/Document/File.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Mar 1 11:04:05 CET 2011


Author: kazuhiko
Date: Tue Mar  1 11:04:05 2011
New Revision: 43844

URL: http://svn.erp5.org?rev=43844&view=rev
Log:
compare by str not by its md5 hash. this is faster in same case, and much faster in different case.

Modified:
    erp5/trunk/products/ERP5/Document/File.py

Modified: erp5/trunk/products/ERP5/Document/File.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/File.py?rev=43844&r1=43843&r2=43844&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/File.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/File.py [utf8] Tue Mar  1 11:04:05 2011
@@ -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)



More information about the Erp5-report mailing list