Commit 1b9dead4 authored by Jérome Perrin's avatar Jérome Perrin

fixup! *: fix python2 compatibility with base64.encodebytes

parent cb38c94f
import six
# pylint:disable=no-name-in-module
if six.PY2:
from base64 import encodestring as encodebytes
else:
from base64 import encodebytes
# pylint:enable=no-name-in-module
portal = context.getPortalObject()
expense_record_module = portal.getDefaultModule('Expense Record')
sender = portal.portal_membership.getAuthenticatedMember().getUserValue()
data = bytes(context.getData())
data64 = u''.join(encodebytes(data).decode().splitlines())
photo_data = u'data:%s;base64,%s' % ("image/*", data64)
data64 = ''.join(encodebytes(data).decode().splitlines())
photo_data = 'data:%s;base64,%s' % ("image/*", data64)
expense_record_module.newContent(
comment=comment,
resource_title=currency,
......
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