Commit 62ae7291 authored by Jérome Perrin's avatar Jérome Perrin

deferred_style: use bz2 and zlib module instead of python2 only syntax

parent 48e2e4fd
import bz2
request = container.REQUEST
request.form.update(report_request)
request.other.update(report_request)
......@@ -25,4 +26,4 @@ with portal.Localizer.translationContext(localizer_language):
report_section.popReport(portal, render_prefix=render_prefix)
return report_section_idx, data.encode('utf8').encode('bz2')
return report_section_idx, bz2.compress(data.encode('utf8'))
# pylint: disable=redefined-builtin
import bz2
import zlib
request = container.REQUEST
request.form.update(report_request)
......@@ -21,9 +23,9 @@ with portal.Localizer.translationContext(localizer_language):
def decodeReportSection(data):
# BBB We use to encode in zlib
try:
return data.decode('bz2')
return bz2.decompress(data)
except IOError:
return data.decode('zlib')
return zlib.decompress(data)
if portal.portal_preferences.getPreferredDeferredReportStoredAsDocument():
pt_render_format = None
else:
......
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