diff --git a/sapl/legacy/scripts/exporta_zope/dump30.py b/sapl/legacy/scripts/exporta_zope/dump30.py index 40a9bfd4e..471bef4e0 100644 --- a/sapl/legacy/scripts/exporta_zope/dump30.py +++ b/sapl/legacy/scripts/exporta_zope/dump30.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + from exporta_zope import (br, dump_folder, dump_propriedades, dump_usuarios, get_app, logando_nao_identificados) @@ -6,11 +8,13 @@ def dump_sapl30(): """Extrai dados do zope de um sapl 3.0, que, ao que tudo indica: * não possui a pasta XSLT * usa um mountpoint separado para os documentos + * usa encoding utf-8 (ao invés de iso-8859-1) """ + destino = '../../../../media' + data_fs_path = destino + '/Data.fs' + docs_path = destino + '/DocumentosSapl.fs' + try: - destino = '../../../../media' - data_fs_path = destino + '/Data.fs' - docs_path = destino + '/DocumentosSapl.fs' app, close_db = get_app(data_fs_path) sapl = br(app['sapl']) dump_usuarios(sapl, destino) @@ -22,6 +26,6 @@ def dump_sapl30(): docs = br(app['sapl_documentos']) with logando_nao_identificados(): dump_folder(docs, destino) - dump_propriedades(docs, destino) + dump_propriedades(docs, destino, 'utf-8') finally: close_db() diff --git a/sapl/legacy/scripts/exporta_zope/exporta_zope.py b/sapl/legacy/scripts/exporta_zope/exporta_zope.py index 80a3e4cdb..695b877f3 100755 --- a/sapl/legacy/scripts/exporta_zope/exporta_zope.py +++ b/sapl/legacy/scripts/exporta_zope/exporta_zope.py @@ -246,11 +246,11 @@ def find_sapl(app): return sapl -def dump_propriedades(docs, path): +def dump_propriedades(docs, path, encoding='iso-8859-1'): props_sapl = br(docs['props_sapl']) ids = [p['id'] for p in props_sapl['_properties']] props = {id: props_sapl[id] for id in ids} - props = {id: p.decode('iso-8859-1') if isinstance(p, str) else p + props = {id: p.decode(encoding) if isinstance(p, str) else p for id, p in props.items()} save_as_yaml(path, 'sapl_documentos/propriedades.yaml', props)