Commit f27568d8 authored by Jérome Perrin's avatar Jérome Perrin Committed by Arnaud Fontaine

py3: cloudooo.git/d4abf3ff: convertFile() take an str() and returns an str().

parent 40ef9c48
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
from Products.PortalTransforms.interfaces import ITransform from Products.PortalTransforms.interfaces import ITransform
from zope.interface import implementer from zope.interface import implementer
from erp5.component.document.Document import DocumentConversionServerProxy, ConversionError, enc, dec from erp5.component.document.Document import DocumentConversionServerProxy, ConversionError, enc, dec
from Products.ERP5Type.Utils import bytes2str, str2bytes
@implementer(ITransform) @implementer(ITransform)
class DocumentConversionServerTransform: class DocumentConversionServerTransform:
""" """
...@@ -51,13 +52,13 @@ class DocumentConversionServerTransform: ...@@ -51,13 +52,13 @@ class DocumentConversionServerTransform:
source_format = self._getFormatFromMimetype(source_mimetype) source_format = self._getFormatFromMimetype(source_mimetype)
destination_format = self._getFormatFromMimetype(self.output) destination_format = self._getFormatFromMimetype(self.output)
data.setData(dec(server_proxy.convertFile( data.setData(dec(str2bytes(server_proxy.convertFile(
enc(orig), byte2str(enc(orig)),
source_format, source_format,
destination_format, destination_format,
# Default values are ConversionServer default ones # Default values are ConversionServer default ones
kwargs.get('zip', False), kwargs.get('zip', False),
kwargs.get('refresh', False), kwargs.get('refresh', False),
kwargs.get('conversion_kw', {})))) kwargs.get('conversion_kw', {})))))
return data return data
\ No newline at end of file
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
from erp5.component.document.Document import DocumentConversionServerProxy from erp5.component.document.Document import DocumentConversionServerProxy
from base64 import b64encode, b64decode from base64 import b64encode, b64decode
from zExceptions import Unauthorized from zExceptions import Unauthorized
from Products.ERP5Type.Utils import bytes2str
def convertDocumentByConversionServer( def convertDocumentByConversionServer(
self, self,
...@@ -48,7 +49,7 @@ def convertDocumentByConversionServer( ...@@ -48,7 +49,7 @@ def convertDocumentByConversionServer(
proxy = DocumentConversionServerProxy(self) proxy = DocumentConversionServerProxy(self)
return b64decode( return b64decode(
proxy.convertFile( proxy.convertFile(
b64encode(data), bytes2str(b64encode(data)),
source_mimetype, source_mimetype,
destination_mimetype, destination_mimetype,
zip, zip,
......
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