Commit e4413072 authored by Tristan Cavelier's avatar Tristan Cavelier

xxx asc+zip

parent 150de840
...@@ -297,18 +297,18 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -297,18 +297,18 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
##### BEGIN hack - handle yformat (should not be OOoDocument) XXX## ##### BEGIN hack - handle yformat (should not be OOoDocument) XXX##
# XXX public cloudooo.erp5.net cannot handle x2t because of an OSError # XXX public cloudooo.erp5.net cannot handle x2t because of an OSError
__traceback_info__ = ("orig_format", orig_format, "format", format) __traceback_info__ = ("orig_format", orig_format, "format", format)
if format in ("docy", "application/x-asc-text"): if format in ("docy", "application/x-asc-text+zip", "application/x-asc-text"):
encdata = server_proxy.convertFile(enc(str(self.getBaseData())), "odt", "docx") encdata = server_proxy.convertFile(enc(str(self.getBaseData())), "odt", "docx")
#orig_format = "application/vnd.openxmlformats-officedocument.wordprocessingml.document" #orig_format = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
return "application/x-asc-text", Pdata(dec(server_proxy.convertFile(encdata, "docx", "docy"))) return "application/x-asc-text", Pdata(dec(server_proxy.convertFile(encdata, "docx", "docy"))) # XXX change to application/x-asc-*+zip ?
if format in ("xsly", "application/x-asc-spreadsheet"): if format in ("xsly", "application/x-asc-spreadsheet+zip", "application/x-asc-spreadsheet"):
encdata = server_proxy.convertFile(enc(str(self.getBaseData())), "ods", "xlsx") encdata = server_proxy.convertFile(enc(str(self.getBaseData())), "ods", "xlsx")
#orig_format = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" #orig_format = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
return "application/x-asc-spreadsheet", Pdata(dec(server_proxy.convertFile(encdata, "xlsx", "xlsy"))) return "application/x-asc-spreadsheet", Pdata(dec(server_proxy.convertFile(encdata, "xlsx", "xlsy"))) # XXX change to application/x-asc-*+zip ?
if format in ("ppty", "application/x-asc-presentation"): if format in ("ppty", "application/x-asc-presentation+zip", "application/x-asc-presentation"):
encdata = server_proxy.convertFile(enc(str(self.getBaseData())), "odp", "pptx") encdata = server_proxy.convertFile(enc(str(self.getBaseData())), "odp", "pptx")
#orig_format = "application/vnd.openxmlformats-officedocument.presentationml.presentation" #orig_format = "application/vnd.openxmlformats-officedocument.presentationml.presentation"
return "application/x-asc-presentation", Pdata(dec(server_proxy.convertFile(encdata, "pptx", "ppty"))) return "application/x-asc-presentation", Pdata(dec(server_proxy.convertFile(encdata, "pptx", "ppty"))) # XXX change to application/x-asc-*+zip ?
##### END hack ##### ##### END hack #####
generate_result = server_proxy.run_generate(self.getId(), generate_result = server_proxy.run_generate(self.getId(),
enc(str(self.getBaseData())), enc(str(self.getBaseData())),
...@@ -404,6 +404,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -404,6 +404,7 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
has_format = self.hasConversion(format=original_format, **kw) has_format = self.hasConversion(format=original_format, **kw)
if not has_format: if not has_format:
# Do real conversion # Do real conversion
# XXX think -> mime, data = self._getConversionFromPortalTransform(format)
mime, data = self._getConversionFromProxyServer(format) mime, data = self._getConversionFromProxyServer(format)
if is_html: if is_html:
# Extra processing required since # Extra processing required since
...@@ -494,15 +495,15 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -494,15 +495,15 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
##### BEGIN hack - handle yformat (which should not be OOoDocument) XXX## ##### BEGIN hack - handle yformat (which should not be OOoDocument) XXX##
content_type = self.getContentType() content_type = self.getContentType()
filename = self.getFilename() or self.getId() filename = self.getFilename() or self.getId()
if content_type == "application/x-asc-text": if content_type in ("application/x-asc-text+zip", "application/x-asc-text"):
encdata = server_proxy.convertFile(enc(str(self.getData())), "docy", "docx") encdata = server_proxy.convertFile(enc(str(self.getData())), "docy", "docx")
content_type = "application/vnd.openxmlformats-officedocument.wordprocessingml.document" content_type = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
filename += ".docx" filename += ".docx"
elif content_type == "application/x-asc-spreadsheet": elif content_type in ("application/x-asc-spreadsheet+zip", "application/x-asc-spreadsheet"):
encdata = server_proxy.convertFile(enc(str(self.getData())), "xlsy", "xlsx") encdata = server_proxy.convertFile(enc(str(self.getData())), "xlsy", "xlsx")
content_type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" content_type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
filename += ".xlsx" filename += ".xlsx"
elif content_type == "application/x-asc-presentation": elif content_type in ("application/x-asc-presentation+zip", "application/x-asc-presentation"):
encdata = server_proxy.convertFile(enc(str(self.getData())), "ppty", "pptx") encdata = server_proxy.convertFile(enc(str(self.getData())), "ppty", "pptx")
content_type = "application/vnd.openxmlformats-officedocument.presentationml.presentation" content_type = "application/vnd.openxmlformats-officedocument.presentationml.presentation"
filename += ".pptx" filename += ".pptx"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment