Commit 79892fcb authored by Jérome Perrin's avatar Jérome Perrin

accounting_l10n_fr: don't use str().encode('zlib')

This only works on python2
parent bc7970ba
import zlib
from Products.CMFActivity.ActiveResult import ActiveResult from Products.CMFActivity.ActiveResult import ActiveResult
portal = context.getPortalObject() portal = context.getPortalObject()
active_process = portal.restrictedTraverse(active_process) active_process = portal.restrictedTraverse(active_process)
...@@ -12,7 +13,7 @@ if result_list: ...@@ -12,7 +13,7 @@ if result_list:
journal_lib=journal_lib, journal_lib=journal_lib,
result_list=result_list) result_list=result_list)
active_process.postResult(ActiveResult(detail=journal_fragment.encode('utf8').encode('zlib'))) active_process.postResult(ActiveResult(detail=zlib.compress(journal_fragment.encode('utf8'))))
# delete no longer needed active process # delete no longer needed active process
this_journal_active_process.getParentValue().manage_delObjects(ids=[this_journal_active_process.getId()]) this_journal_active_process.getParentValue().manage_delObjects(ids=[this_journal_active_process.getId()])
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
<comptabilite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="formatA47A-I-VII-1.xsd" xmlns:tal="http://xml.zope.org/namespaces/tal"> <comptabilite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="formatA47A-I-VII-1.xsd" xmlns:tal="http://xml.zope.org/namespaces/tal">
<exercice> <exercice>
<DateCloture tal:content="python: options['at_date'].strftime('%Y-%m-%d')">20141231</DateCloture> <DateCloture tal:content="python: options['at_date'].strftime('%Y-%m-%d')">20141231</DateCloture>
<tal:block tal:repeat="result options/result_list"><tal:block tal:replace="structure python: result.detail.decode('zlib')"/></tal:block> <tal:block tal:repeat="result options/result_list"><tal:block tal:replace="structure python: modules['zlib'].decompress(result.detail)"/></tal:block>
</exercice> </exercice>
</comptabilite> </comptabilite>
\ No newline at end of file
<journal xmlns:tal="http://xml.zope.org/namespaces/tal"> <journal xmlns:tal="http://xml.zope.org/namespaces/tal">
<JournalCode tal:content="options/journal_code"></JournalCode> <JournalCode tal:content="options/journal_code"></JournalCode>
<JournalLib tal:content="options/journal_lib"></JournalLib> <JournalLib tal:content="options/journal_lib"></JournalLib>
<tal:block tal:repeat="result options/result_list"><tal:block tal:replace="structure python: result.detail.decode('zlib')"/></tal:block> <tal:block tal:repeat="result options/result_list"><tal:block tal:replace="structure python: modules['zlib'].decompress(result.detail)"/></tal:block>
</journal> </journal>
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
active result. active result.
We need a proxy role to post the result. We need a proxy role to post the result.
""" """
import zlib
from Products.CMFActivity.ActiveResult import ActiveResult from Products.CMFActivity.ActiveResult import ActiveResult
portal = context.getPortalObject() portal = context.getPortalObject()
...@@ -12,10 +13,10 @@ if context.getSourceSectionUid() in section_uid_list: ...@@ -12,10 +13,10 @@ if context.getSourceSectionUid() in section_uid_list:
if any([line.getSource(portal_type='Account') for line in accounting_line_list]): if any([line.getSource(portal_type='Account') for line in accounting_line_list]):
source_xml = context.AccountingTransaction_viewAsSourceFECXML( source_xml = context.AccountingTransaction_viewAsSourceFECXML(
test_compta_demat_compatibility=test_compta_demat_compatibility) test_compta_demat_compatibility=test_compta_demat_compatibility)
active_process.postResult(ActiveResult(detail=source_xml.encode('utf8').encode('zlib'))) active_process.postResult(ActiveResult(detail=zlib.compress(source_xml.encode('utf8'))))
if context.getDestinationSectionUid() in section_uid_list: if context.getDestinationSectionUid() in section_uid_list:
if any([line.getDestination(portal_type='Account') for line in accounting_line_list]): if any([line.getDestination(portal_type='Account') for line in accounting_line_list]):
destination_xml = context.AccountingTransaction_viewAsDestinationFECXML( destination_xml = context.AccountingTransaction_viewAsDestinationFECXML(
test_compta_demat_compatibility=test_compta_demat_compatibility) test_compta_demat_compatibility=test_compta_demat_compatibility)
active_process.postResult(ActiveResult(detail=destination_xml.encode('utf8').encode('zlib'))) active_process.postResult(ActiveResult(detail=zlib.compress(destination_xml.encode('utf8'))))
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