From f257c13dd145699b9477f14ffd43d59b36234dfb Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Thu, 14 Jun 2018 20:33:31 -0300 Subject: [PATCH] =?UTF-8?q?Corrige=20busca=20do=20sapl=20dentro=20do=20Dat?= =?UTF-8?q?a.fs=20na=20exporta=C3=A7=C3=A3o?= 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, 7 insertions(+), 5 deletions(-) diff --git a/sapl/legacy/scripts/exporta_zope/exporta_zope.py b/sapl/legacy/scripts/exporta_zope/exporta_zope.py index 7494dca17..270c90583 100755 --- a/sapl/legacy/scripts/exporta_zope/exporta_zope.py +++ b/sapl/legacy/scripts/exporta_zope/exporta_zope.py @@ -17,14 +17,14 @@ from functools import partial import git import magic import yaml -from unipath import Path - import ZODB.DB import ZODB.FileStorage -from variaveis_comuns import DIR_DADOS_MIGRACAO, TAG_ZOPE +from unipath import Path from ZODB.broken import Broken from ZODB.POSException import POSKeyError +from variaveis_comuns import DIR_DADOS_MIGRACAO, TAG_ZOPE + EXTENSOES = { 'application/msword': '.doc', 'application/pdf': '.pdf', @@ -291,8 +291,10 @@ def get_app(data_fs_path): def find_sapl(app): - for obj in app['_objects']: - id, meta_type = obj['id'], obj['meta_type'] + ids_meta_types = [(obj['id'], obj['meta_type']) for obj in app['_objects']] + # estar ordenado é muito importante para que a busca dê prioridade + # a um id "cm_zzz" antes do id "sapl" + for id, meta_type in sorted(ids_meta_types): if id.startswith('cm_') and meta_type == 'Folder': cm_zzz = br(app[id]) return find_sapl(cm_zzz)