Commit 3549a0c5 authored by Nicolas Delaby's avatar Nicolas Delaby

Add temporary patch to enable updateContentMd5 calls on TextDocument



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34927 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c1a2ba07
......@@ -37,6 +37,7 @@ from Products.ERP5Type import Permissions, PropertySheet
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 @@ class TextDocument(Document, TextContent):
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)
......@@ -181,3 +181,5 @@ class CachedConvertableMixin:
if data is not None:
data = str(data) # Usefull for Pdata
self._setContentMd5(md5.new(data).hexdigest()) # Reindex is useless
else:
self._setContentMd5(None)
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