r252841 - Products.AROfficeTransforms/branches/optimisations-xls/Products/AROfficeTransforms/transforms

"Vincent Fretin" <svn-changes-z4DKO/[email protected]> Wed, 3 Dec 2014 16:44:20 +0000 (UTC)
Newsgroups gmane.comp.web.zope.plone.collective.cvs
Message-ID <[email protected]>
Author: vincentfretin
Date: Wed Dec  3 16:44:19 2014
New Revision: 252841

Modified:
   Products.AROfficeTransforms/branches/optimisations-xls/Products/AROfficeTransforms/transforms/office_wvware_gen.py
Log:
only open the converted file if it exists (conversion failed)

Modified: Products.AROfficeTransforms/branches/optimisations-xls/Products/AROfficeTransforms/transforms/office_wvware_gen.py
==============================================================================
--- Products.AROfficeTransforms/branches/optimisations-xls/Products/AROfficeTransforms/transforms/office_wvware_gen.py	(original)
+++ Products.AROfficeTransforms/branches/optimisations-xls/Products/AROfficeTransforms/transforms/office_wvware_gen.py	Wed Dec  3 16:44:19 2014
@@ -62,7 +62,11 @@
             sts = os.waitpid(p.pid, 0)
 
     def _html(self):
-        htmlfile = open(pjoin(self.tmpdir, self.__name__+".html"), 'r')
+        filename = pjoin(self.tmpdir, self.__name__+".html")
+        if not os.path.exists(filename):
+            return ""
+
+        htmlfile = open(filename, 'r')
         html = htmlfile.read()
         htmlfile.close()
         #html = scrubHTML(html)
@@ -71,7 +75,11 @@
         return body
 
     def _text(self):
-        txtfile = open(pjoin(self.tmpdir, self.__name__+".txt"), 'r')
+        filename = pjoin(self.tmpdir, self.__name__+".txt")
+        if not os.path.exists(filename):
+            return ""
+
+        txtfile = open(filename, 'r')
         text = txtfile.read()
         txtfile.close()
         return text

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk