2011-02-09 19:48:59 |
Roman Jansen-Winkeln |
description |
We stumbled in problems with broken TAR-Exports from GenericSetup exports of DCWorkflows.
The reason: oour interactively defined Workflows contained Non-Ascii Unicode Characters.
Python operates in "utf-8" mode.
For the enclosed example file "definitions.xml", the method "writeDataFile" in class "TarballExportContext" in file "context.py" of Products.GenerictSetup-1.6.1 reports in "info.size = len( text )" a length of 8300 characters. The real length of the file is however 8324 bytes, which is len(str(text)).
The relevant workflow in the attached (fixed) export is
We have developped a simple workaround and replaced the original:
stream = StringIO( text )
info = TarInfo( filename )
info.size = len( text )
with
text = str(text) ### Patch to convert unicode to bytes [RJW 2011-02-09]
stream = StringIO( text )
info = TarInfo( filename )
info.size = len( text ) # len is wrong for utf-8 encoding
It works fine for our purposes. There may surely be a more elegant solution.
The bug appears in Plone 3.3.x and in Plone 4.0.x
Best Regards
roman |
We stumbled in problems with broken TAR-Exports from GenericSetup exports of DCWorkflows.
The reason: our interactively defined workflows contained non-ascii unicode characters.
For the enclosed example file "definitions.xml", the method "writeDataFile" in class "TarballExportContext" in file "context.py" of Products.GenerictSetup-1.6.1 reports in "info.size = len( text )" a length of 8300 characters. The real length of the file is however 8324 bytes, which is len(str(text)).
The relevant workflow in the attached (fixed) export is
We have developped a simple workaround and replaced the original:
stream = StringIO( text )
info = TarInfo( filename )
info.size = len( text )
with
text = str(text) ### Patch to convert unicode to bytes [RJW 2011-02-09]
stream = StringIO( text )
info = TarInfo( filename )
info.size = len( text ) # len is wrong for utf-8 encoding
It works fine for our purposes. There may surely be a more elegant solution.
The bug appears in Plone 3.3.x and in Plone 4.0.x . Python operates in "utf-8" mode.
Best Regards
roman
|
|