[Erp5-report] r29036 - /erp5/trunk/products/ERP5/Document/Document.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Sep 14 19:17:31 CEST 2009
Author: rafael
Date: Mon Sep 14 19:17:27 2009
New Revision: 29036
URL: http://svn.erp5.org?rev=29036&view=rev
Log:
update_data use len(data) when size is None, which breaks this method (setData).
define size = 0 when data is None, will prevent len be use update_data and keep the consistency of getData() and setData().
Other alternative should monkey patch update_data or avoid his usage removing "if/else".
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=29036&r1=29035&r2=29036&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Document.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Document.py [utf8] Mon Sep 14 19:17:27 2009
@@ -1416,11 +1416,17 @@
be a interface for all classes which can act as a File.
"""
size = None
+ # update_data use len(data) when size is None, which breaks this method.
+ # define size = 0 will prevent len be use and keep the consistency of
+ # getData() and setData()
+ if data is None:
+ size = 0
if not isinstance(data, Pdata) and data is not None:
file = cStringIO.StringIO(data)
data, size = self._read_data(file)
if getattr(self, 'update_data', None) is not None:
- self.update_data(data, size=size) # We call this method to make sure size is set and caches reset
+ # We call this method to make sure size is set and caches reset
+ self.update_data(data, size=size)
else:
self._baseSetData(data) # XXX - It would be better to always use this accessor
self.size=size # Using accessor or caching method would be better
More information about the Erp5-report
mailing list