[Erp5-report] r34927 nicolas - in /erp5/trunk/products/ERP5: Document/ mixin/

nobody at svn.erp5.org nobody at svn.erp5.org
Mon May 3 12:06:10 CEST 2010


Author: nicolas
Date: Mon May  3 12:06:09 2010
New Revision: 34927

URL: http://svn.erp5.org?rev=34927&view=rev
Log:
Add temporary patch to enable updateContentMd5 calls on TextDocument


Modified:
    erp5/trunk/products/ERP5/Document/TextDocument.py
    erp5/trunk/products/ERP5/mixin/cached_convertable.py

Modified: erp5/trunk/products/ERP5/Document/TextDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TextDocument.py?rev=34927&r1=34926&r2=34927&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TextDocument.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TextDocument.py [utf8] Mon May  3 12:06:09 2010
@@ -37,6 +37,7 @@
 from Products.ERP5.Document.Document import Document, ConversionError
 from Products.ERP5Type.WebDAVSupport import TextContent
 import re
+import md5
 
 try:
   from string import Template
@@ -295,3 +296,19 @@
     def getMimeTypeAndContent(self):
       """This method returns a tuple which contains mimetype and content."""
       return (self.getTextFormat(), self.getTextContent())
+
+    security.declareProtected(Permissions.ModifyPortalContent, 'updateContentMd5')
+    def updateContentMd5(self):
+     """Update md5 checksum from the original file
+     
+     XXX-JPS - this method is not part of any interfacce.
+               should it be public or private. It is called
+               by some interaction workflow already. Is
+               it general or related to caching only ?
+     """
+     data = self.getTextContent()
+     if data is not None:
+       data = str(data) # Usefull for Pdata
+       self._setContentMd5(md5.new(data).hexdigest()) # Reindex is useless
+     else:
+       self._setContentMd5(None)

Modified: erp5/trunk/products/ERP5/mixin/cached_convertable.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/mixin/cached_convertable.py?rev=34927&r1=34926&r2=34927&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/mixin/cached_convertable.py [utf8] (original)
+++ erp5/trunk/products/ERP5/mixin/cached_convertable.py [utf8] Mon May  3 12:06:09 2010
@@ -181,3 +181,5 @@
     if data is not None:
       data = str(data) # Usefull for Pdata
       self._setContentMd5(md5.new(data).hexdigest()) # Reindex is useless
+    else:
+      self._setContentMd5(None)




More information about the Erp5-report mailing list