[Erp5-report] r31569 jerome - /erp5/trunk/products/ERP5/Document/Document.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Jan 5 11:13:35 CET 2010
Author: jerome
Date: Tue Jan 5 11:13:31 2010
New Revision: 31569
URL: http://svn.erp5.org?rev=31569&view=rev
Log:
support empty documents:
- getPropretyDictFromContent does not try to find anything from empty content
- convertTotBaseFormat does not try to convert
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=31569&r1=31568&r2=31569&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Document.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Document.py [utf8] Tue Jan 5 11:13:31 2010
@@ -986,6 +986,9 @@
Based on the document content, find out as many properties as needed.
returns properties which should be set on the document
"""
+ if not self.hasData():
+ # if document is empty, we will not find anything in its content
+ return dict()
if not self.hasBaseData():
raise NotConvertedError
method = self._getTypeBasedMethod('getPropertyDictFromContent',
@@ -1274,6 +1277,9 @@
using the base_data property. Refer to Document.py propertysheet.
Use accessors (getBaseData, setBaseData, hasBaseData, etc.)
"""
+ if not self.hasData():
+ # Empty document cannot be converted
+ return #'Document is empty'
try:
message = self._convertToBaseFormat() # Call implemetation method
self.clearConversionCache() # Conversion cache is now invalid
More information about the Erp5-report
mailing list