[Erp5-report] r41849 nicolas - in /erp5/trunk/products/ERP5: Document/ mixin/
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Dec 29 11:40:07 CET 2010
Author: nicolas
Date: Wed Dec 29 11:40:07 2010
New Revision: 41849
URL: http://svn.erp5.org?rev=41849&view=rev
Log:
content_md5 needs to compute its value against original value.
As TextDocument can store this original value in data property (Ingestion Input)
or text_content property (UI Input).
content_md5 is computed against getData, then TextDocument instances must fallback
on getTextContent if data is empty.
getData usage is unified among all types of documents.
Additional Comments:
TextDocument._convert() still rely on text_content value as raw_data.
because if data exists, text_content also, as a base conversion of data.
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=41849&r1=41848&r2=41849&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TextDocument.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TextDocument.py [utf8] Wed Dec 29 11:40:07 2010
@@ -390,3 +390,19 @@ class TextDocument(CachedConvertableMixi
LOG('TextDocument', WARNING,
'Usage of text_format is deprecated, use text_content instead')
return self._setContentType(value)
+
+ def getData(self, default=_MARKER):
+ """getData must returns original content but TextDocument accepts
+ data or text_content to store original content.
+ Fallback on text_content property if data is not defined
+ """
+ if not self.hasData():
+ if default is _MARKER:
+ return self.getTextContent()
+ else:
+ return self.getTextContent(default)
+ else:
+ if default is _MARKER:
+ return File.getData(self)
+ else:
+ return File.getData(self, default)
Modified: erp5/trunk/products/ERP5/mixin/cached_convertable.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/mixin/cached_convertable.py?rev=41849&r1=41848&r2=41849&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/mixin/cached_convertable.py [utf8] (original)
+++ erp5/trunk/products/ERP5/mixin/cached_convertable.py [utf8] Wed Dec 29 11:40:07 2010
@@ -247,7 +247,7 @@ class CachedConvertableMixin:
def updateContentMd5(self):
"""Update md5 checksum from the original file
"""
- mime, data = self.convert(None)
+ data = self.getData()
if data is not None:
if isinstance(data, Pdata):
self._setContentMd5(hashPdataObject(aq_base(data)))
More information about the Erp5-report
mailing list