From c37f1444bc71b64e2d9058fbe534f80dcee04595 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Tue, 20 Feb 2018 11:14:43 -0300 Subject: [PATCH] =?UTF-8?q?preserva=20extens=C3=B5es=20xslt=20na=20exporta?= =?UTF-8?q?=C3=A7=C3=A3o=20de=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/legacy/scripts/exporta_zope/exporta_zope.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sapl/legacy/scripts/exporta_zope/exporta_zope.py b/sapl/legacy/scripts/exporta_zope/exporta_zope.py index 695b877f3..1ba4cecc2 100755 --- a/sapl/legacy/scripts/exporta_zope/exporta_zope.py +++ b/sapl/legacy/scripts/exporta_zope/exporta_zope.py @@ -14,7 +14,6 @@ from functools import partial import magic import yaml - import ZODB.DB import ZODB.FileStorage from ZODB.broken import Broken @@ -100,10 +99,15 @@ def dump_file(doc, path): arq.write(pdata.pop('data')) pdata = br(pdata.pop('next', None)) - base = os.path.splitext(fullname)[0] + base, original_extension = os.path.splitext(fullname) extension = guess_extension(fullname) - final_name = base + extension - os.rename(fullname, final_name) + if extension == '.xml' and original_extension in ['.xsl', '.xslt']: + # não trocamos as extensões XSL e XSLT + final_name = fullname + else: + # trocamos a extensão pela adivinhada + final_name = base + extension + os.rename(fullname, final_name) print(final_name) return name