João Rodrigues
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with
15 additions and
9 deletions
-
sapl/crispy_layout_mixin.py
-
sapl/legacy/migracao_dados.py
-
sapl/legacy/migracao_usuarios.py
-
sapl/legacy/scripts/exporta_zope/exporta_zope.py
-
sapl/legacy/scripts/ressuscita_dependencias.py
-
sapl/legacy_migration_settings.py
-
sapl/test_crispy_layout_mixin.py
|
|
@ -337,7 +337,7 @@ def read_yaml_from_file(yaml_layout): |
|
|
|
if isinstance(rendered, SafeText): |
|
|
|
rendered = rendered.strip() |
|
|
|
|
|
|
|
return yaml.load(rendered) |
|
|
|
return yaml.load(rendered, yaml.Loader) |
|
|
|
|
|
|
|
|
|
|
|
def read_layout_from_yaml(yaml_layout, key): |
|
|
|
|
|
@ -110,7 +110,9 @@ def get_renames(): |
|
|
|
includes = {} |
|
|
|
for app in appconfs: |
|
|
|
app_rename_data = yaml.load( |
|
|
|
pkg_resources.resource_string(app.module.__name__, 'legacy.yaml')) |
|
|
|
pkg_resources.resource_string(app.module.__name__, 'legacy.yaml'), |
|
|
|
yaml.Loader |
|
|
|
) |
|
|
|
for model_name, renames in app_rename_data.items(): |
|
|
|
# armazena ou substitui includes |
|
|
|
if MODEL_RENAME_INCLUDE_PATTERN.match(model_name): |
|
|
@ -1175,7 +1177,7 @@ def get_arquivo_resolve_registro_votacao(): |
|
|
|
def get_como_resolver_registro_votacao_ambiguo(): |
|
|
|
path = get_arquivo_resolve_registro_votacao() |
|
|
|
if path.exists(): |
|
|
|
return yaml.load(path.read_file()) |
|
|
|
return yaml.load(path.read_file(), yaml.Loader) |
|
|
|
else: |
|
|
|
return {} |
|
|
|
|
|
|
|
|
|
@ -71,7 +71,7 @@ def migrar_usuarios(dir_repo): |
|
|
|
|
|
|
|
ARQUIVO_USUARIOS = Path(dir_repo).child('usuarios.yaml') |
|
|
|
with open(ARQUIVO_USUARIOS, 'r') as f: |
|
|
|
usuarios = yaml.load(f) |
|
|
|
usuarios = yaml.load(f, yaml.Loader) |
|
|
|
# conferimos de que só há um nome de usuário |
|
|
|
assert all(nome == dados['name'] for nome, dados in usuarios.items()) |
|
|
|
usuarios = [ |
|
|
|
|
|
@ -471,7 +471,9 @@ def dump_sapl(sigla): |
|
|
|
finalizado = False |
|
|
|
arq_mtimes = Path(repo.working_dir, 'mtimes.yaml') |
|
|
|
mtimes = yaml.load( |
|
|
|
arq_mtimes.read_file()) if arq_mtimes.exists() else {} |
|
|
|
arq_mtimes.read_file(), |
|
|
|
yaml.Loader |
|
|
|
) if arq_mtimes.exists() else {} |
|
|
|
_dump_sapl(data_fs_path, documentos_fs_path, destino, salvar, mtimes) |
|
|
|
finalizado = True |
|
|
|
finally: |
|
|
|
|
|
@ -197,7 +197,9 @@ Para facilitar sua conferência, seguem os links para as proposições envolvida |
|
|
|
|
|
|
|
def get_dependencias_a_ressuscitar(slug): |
|
|
|
ocorrencias = yaml.load( |
|
|
|
Path(DIR_REPO.child('ocorrencias.yaml').read_file())) |
|
|
|
Path(DIR_REPO.child('ocorrencias.yaml').read_file()), |
|
|
|
yaml.Loader |
|
|
|
) |
|
|
|
fks_faltando = ocorrencias.get('fk') |
|
|
|
if not fks_faltando: |
|
|
|
return [], [], [] |
|
|
@ -412,7 +414,7 @@ def get_ressuscitar(slug): |
|
|
|
def get_slug(): |
|
|
|
arq = DIR_DADOS_MIGRACAO.child('siglas_para_slugs.yaml') |
|
|
|
with open(arq, 'r') as arq: |
|
|
|
siglas_para_slugs = yaml.load(arq) |
|
|
|
siglas_para_slugs = yaml.load(arq, yaml.Loader) |
|
|
|
sigla = NOME_BANCO_LEGADO[-3:] |
|
|
|
return siglas_para_slugs[sigla] |
|
|
|
|
|
|
|
|
|
@ -54,7 +54,7 @@ match = re.match('sapl_cm_(.*)', NOME_BANCO_LEGADO) |
|
|
|
SIGLA_CASA = match.group(1) |
|
|
|
_PATH_TABELA_TIMEZONES = DIR_DADOS_MIGRACAO.child('tabela_timezones.yaml') |
|
|
|
with open(_PATH_TABELA_TIMEZONES, 'r') as arq: |
|
|
|
tabela_timezones = yaml.load(arq) |
|
|
|
tabela_timezones = yaml.load(arq, yaml.Loader) |
|
|
|
municipio, uf, nome_timezone = tabela_timezones[SIGLA_CASA] |
|
|
|
if nome_timezone: |
|
|
|
PYTZ_TIMEZONE = pytz.timezone(nome_timezone) |
|
|
|
|
|
@ -18,7 +18,7 @@ ModelName: |
|
|
|
- highlander ''' |
|
|
|
|
|
|
|
with mock.patch('sapl.crispy_layout_mixin.read_yaml_from_file') as ryff: |
|
|
|
ryff.return_value = yaml.load(stub_content) |
|
|
|
ryff.return_value = yaml.load(stub_content, yaml.Loader) |
|
|
|
assert read_layout_from_yaml('....', 'ModelName') == [ |
|
|
|
['Cool Legend', |
|
|
|
[('name', 9), ('place', 2), ('tiny', 1)], |
|
|
|