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

base64 WIP

parent 649083df
......@@ -3,6 +3,7 @@
from Products.PortalTransforms.interfaces import ITransform
from zope.interface import implementer
from erp5.component.document.Document import DocumentConversionServerProxy, ConversionError, enc, dec
@implementer(ITransform)
class DocumentConversionServerTransform:
"""
......@@ -52,12 +53,12 @@ class DocumentConversionServerTransform:
destination_format = self._getFormatFromMimetype(self.output)
data.setData(dec(server_proxy.convertFile(
enc(orig),
enc(orig).decode(),
source_format,
destination_format,
# Default values are ConversionServer default ones
kwargs.get('zip', False),
kwargs.get('refresh', False),
kwargs.get('conversion_kw', {}))))
kwargs.get('conversion_kw', {})).encode()))
return data
\ No newline at end of file
......@@ -48,7 +48,7 @@ def convertDocumentByConversionServer(
proxy = DocumentConversionServerProxy(self)
return b64decode(
proxy.convertFile(
b64encode(data),
b64encode(data).decode(),
source_mimetype,
destination_mimetype,
zip,
......
......@@ -106,7 +106,7 @@ class BaseExtensibleTraversableMixin(ExtensibleTraversableMixin):
# this logic is copied from identify() in
# AccessControl.User.BasicUserFolder.
if auth and auth.lower().startswith('basic '):
name = decodebytes(auth.split(' ')[-1]).split(':', 1)[0]
name = decodebytes(auth.split(' ')[-1].encode()).decode().split(':', 1)[0]
if name is not None:
user = portal_membership._huntUser(name, self)
else:
......
......@@ -228,11 +228,11 @@ class OOOdCommandTransform(commandtransform):
response_code, response_dict, message = server_proxy.run_generate(
'',
enc(self.data),
enc(self.data).decode(),
None,
format,
self.mimetype)
data = dec(response_dict['data'])
data = dec(response_dict['data'].encode())
if self.mimetype == 'text/html':
data = self.includeImageList(data)
return data
......
......@@ -193,7 +193,7 @@ def credentialsChanged(self, user, name, pw, request=None):
# <patch>
# We don't want new lines, so use base64.standard_b64encode instead of
# base64.encodebytes
ac = standard_b64encode('%s:%s' % (name, pw)).rstrip()
ac = standard_b64encode(('%s:%s' % (name, pw)).encode()).rstrip().decode()
# </patch>
method = self.getCookieMethod('setAuthCookie',
self.defaultSetAuthCookie)
......
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