diff options
| author | xmo-odoo <xmo@odoo.com> | 2017-06-28 15:35:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-28 15:35:53 +0200 |
| commit | 98602e93cc3f8586db5d22932aecdd5192584a55 (patch) | |
| tree | 107ce5d547db6543fb0b622312802cc9a2632faf /addons/web/static/src/js/views/basic | |
| parent | 81ff060fb4f92eb08fdc7403173cf4cc2a8f5687 (diff) | |
[FIX] PO translations export
Within the scope of P3 compatibility, a StringIO was replaced by
BytesIO in b4429c2a91889bf60b56e0c7909c844d357363f7, however I missed
that BytesIO is much stricter about types than StringIO *even in
Python 2*. Some bits of text would sneak up in PoFile.write or
PoFile.write_info and blow up the export.
The BytesIO makes sense for output (tgz is definitely not a text
format and base64 is a bytes -> bytes encoding), but ensuring the
entirety of PoFile worked on bytes seemed distasteful (and lots of
changes), it seemed more sensible at all levels that PoFile would make
sure to properly work on *text*, and to add a text adapter wrapper
around the BytesIO buffer.
io.TextIOWrapper was almost perfect (it closes the underlying stream
on close but that can be worked around) *however* it turns out
TextIOWrapper does not work on Python 2's `file` objects... so use the
older codecs.StreamReaderWriter which should be able to do the job
properly.
fixes #17834
Diffstat (limited to 'addons/web/static/src/js/views/basic')
0 files changed, 0 insertions, 0 deletions
