[Erp5-report] r37475 gabriel - in /erp5/trunk/utils/cloudooo/cloudooo: ./ bin/ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Aug 4 15:21:19 CEST 2010
Author: gabriel
Date: Wed Aug 4 15:21:15 2010
New Revision: 37475
URL: http://svn.erp5.org?rev=37475&view=rev
Log:
fix compatibility between cloudooo and ERP5. When a presentation document is converted to html, ERP5 expects the main document in the format 'impr.html. And, add a test to validate it.
Modified:
erp5/trunk/utils/cloudooo/cloudooo/bin/unoconverter.py
erp5/trunk/utils/cloudooo/cloudooo/ooolib.py
erp5/trunk/utils/cloudooo/cloudooo/tests/testServer.py
Modified: erp5/trunk/utils/cloudooo/cloudooo/bin/unoconverter.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/bin/unoconverter.py?rev=37475&r1=37474&r2=37475&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/bin/unoconverter.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/bin/unoconverter.py [utf8] Wed Aug 4 15:21:15 2010
@@ -93,6 +93,10 @@ class UnoConverter(object):
property_list.append(property)
property = ooolib.createProperty("FilterName", filter_name)
property_list.append(property)
+ if destination_format == "html":
+ # XXX - condition to obtain a property that returns all images in png
+ # format
+ property_list.append(ooolib.createHTMLProperty())
return property_list
else:
return ()
@@ -109,11 +113,13 @@ class UnoConverter(object):
self.document_type = module_manager.identify(uno_document)
self.document_loaded = uno_document
- def convert(self, destination_format=None):
- """ """
+ def convert(self, output_format=None):
+ """it converts a document to specific format"""
+ destination_format = "impr.html" if output_format == "html" else output_format
output_url = mktemp(suffix='.%s' % destination_format,
dir=self.document_dir_path)
- property_list = self._getPropertyToExport(destination_format)
+
+ property_list = self._getPropertyToExport(output_format)
try:
self.document_loaded.storeToURL(ooolib.systemPathToFileUrl(output_url),
tuple(property_list))
Modified: erp5/trunk/utils/cloudooo/cloudooo/ooolib.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/ooolib.py?rev=37475&r1=37474&r2=37475&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/ooolib.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/ooolib.py [utf8] Wed Aug 4 15:21:15 2010
@@ -60,6 +60,19 @@ def createProperty(name, value):
property.Value = value
return property
+# XXX - method duplicated
+def createHTMLProperty():
+ """Returns a property to create all images in png format"""
+ setUpUnoEnvironment()
+ import uno
+ from com.sun.star.beans import PropertyValue
+
+ property = PropertyValue('FilterData', 0,
+ uno.Any('[]com.sun.star.beans.PropertyValue',
+ (PropertyValue('IsExportNotes', 0, True, 0),
+ PropertyValue('Format', 0, 2, 0),),), 0) # PNG format
+ return property
+
def getServiceManager(host, port):
"""Get the ServiceManager from the running OpenOffice.org."""
setUpUnoEnvironment()
Modified: erp5/trunk/utils/cloudooo/cloudooo/tests/testServer.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/tests/testServer.py?rev=37475&r1=37474&r2=37475&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/tests/testServer.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/tests/testServer.py [utf8] Wed Aug 4 15:21:15 2010
@@ -32,6 +32,7 @@ from subprocess import Popen, PIPE
from xmlrpclib import ServerProxy, Fault
from base64 import encodestring, decodestring
from cloudoooTestCase import cloudoooTestCase, make_suite
+from zipfile import ZipFile, is_zipfile
from types import DictType
class TestServer(cloudoooTestCase):
@@ -421,6 +422,15 @@ at least v2.0 to extract\n'
self.assertEquals(type(response_dict), DictType)
self.assertNotEquals(response_dict['data'], '')
self.assertEquals(response_dict['mime'], 'text/html')
+ output_url = "./output/zip.zip"
+ open(output_url, 'w').write(decodestring(response_dict['data']))
+ self.assertTrue(is_zipfile(output_url))
+ filename_list = [file.filename for file in ZipFile(output_url).filelist]
+ for filename in filename_list:
+ if filename.endswith("impr.html"):
+ break
+ else:
+ self.fail("Not exists one file with 'impr.html' format")
def testRunGenerateMethodConvertOdpToHTML(self):
"""Test run_generate method. This test is to validate a bug convertions to
More information about the Erp5-report
mailing list