[Erp5-report] r23330 - /erp5/trunk/products/MailTemplates/MTMultipart.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Sep 2 10:47:52 CEST 2008
Author: jm
Date: Tue Sep 2 10:47:48 2008
New Revision: 23330
URL: http://svn.erp5.org?rev=23330&view=rev
Log:
Allow empty files to be added through the 'data' parameter.
Modified:
erp5/trunk/products/MailTemplates/MTMultipart.py
Modified: erp5/trunk/products/MailTemplates/MTMultipart.py
URL: http://svn.erp5.org/erp5/trunk/products/MailTemplates/MTMultipart.py?rev=23330&r1=23329&r2=23330&view=diff
==============================================================================
--- erp5/trunk/products/MailTemplates/MTMultipart.py (original)
+++ erp5/trunk/products/MailTemplates/MTMultipart.py Tue Sep 2 10:47:48 2008
@@ -42,15 +42,15 @@
security.declarePublic('add_file')
def add_file(self,theFile=None,data=None,filename=None,content_type=None):
"add a Zope file or Image to ourselves as an attachment"
- if theFile and data:
+ if theFile and data is not None:
raise TypeError(
'A file-like object was passed as well as data to create a file'
)
- if (data or filename) and not (data and filename):
+ if (data is None) != (not filename):
raise TypeError(
'Both data and filename must be specified'
)
- if data:
+ if data is not None:
if content_type is None:
content_type, enc=guess_content_type(filename, data)
elif isinstance(theFile,File):
More information about the Erp5-report
mailing list