[Erp5-report] r35251 nicolas - /erp5/trunk/products/ERP5OOo/Document/OOoDocument.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed May 12 18:55:29 CEST 2010
Author: nicolas
Date: Wed May 12 18:55:29 2010
New Revision: 35251
URL: http://svn.erp5.org?rev=35251&view=rev
Log:
* Check if hasBaseData only once
* if no conversion is asked return original document
Modified:
erp5/trunk/products/ERP5OOo/Document/OOoDocument.py
Modified: erp5/trunk/products/ERP5OOo/Document/OOoDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/Document/OOoDocument.py?rev=35251&r1=35250&r2=35251&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/Document/OOoDocument.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/Document/OOoDocument.py [utf8] Wed May 12 18:55:29 2010
@@ -311,14 +311,18 @@
#XXX but I don't know what is a appropriate mime-type.(Yusei)
if self.get_size() == 0:
return 'text/plain', ''
-
+ # if no conversion asked (format empty)
+ # return raw data
+ if not format:
+ return self.getContentType(), self.getData()
+ # Check if we have already a base conversion
+ if not self.hasBaseData():
+ raise NotConvertedError
# Make sure we can support html and pdf by default
is_html = 0
requires_pdf_first = 0
original_format = format
if format == 'base-data':
- if not self.hasBaseData():
- raise NotConvertedError
return self.getBaseContentType(), str(self.getBaseData())
if format == 'pdf':
format_list = [x for x in self.getTargetFormatList()
@@ -356,9 +360,6 @@
# Raise an error if the format is not supported
if not self.isTargetFormatAllowed(format):
raise ConversionError("OOoDocument: target format %s is not supported" % format)
- # Check if we have already a base conversion
- if not self.hasBaseData():
- raise NotConvertedError
# Return converted file
if requires_pdf_first:
# We should use original_format whenever we wish to
More information about the Erp5-report
mailing list