[Erp5-report] r35218 nicolas - /erp5/trunk/products/ERP5/Document/Document.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed May 12 15:38:03 CEST 2010


Author: nicolas
Date: Wed May 12 15:37:50 2010
New Revision: 35218

URL: http://svn.erp5.org?rev=35218&view=rev
Log:
Do not assert that data comes from getData,
let convert method return the expected data (for TextDocument, data comes from
text_content).
Also, convert method only should raise NotConvertedError if needed

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

Modified: erp5/trunk/products/ERP5/Document/Document.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Document.py?rev=35218&r1=35217&r2=35218&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Document.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Document.py [utf8] Wed May 12 15:37:50 2010
@@ -967,11 +967,11 @@
       Based on the document content, find out as many properties as needed.
       returns properties which should be set on the document
     """
-    if getattr(self, 'hasData', None) is not None and not self.hasData():
-      # if document is empty, we will not find anything in its content
-      return dict()
-    if not self.hasBaseData():
-      raise NotConvertedError
+    # accesss data through convert
+    mime, content = self.convert(None)
+    if not content:
+       # if document is empty, we will not find anything in its content
+      return {}
     method = self._getTypeBasedMethod('getPropertyDictFromContent',
         fallback_script_id='Document_getPropertyDictFromContent')
     return method()




More information about the Erp5-report mailing list