From b967eb295cbdd2c91573ac7a234a8fb3721d2763 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Tue, 16 Apr 2019 14:38:43 -0300 Subject: [PATCH 1/2] =?UTF-8?q?HOT-FIX:=20adiciona=20nome=20do=20estado=20?= =?UTF-8?q?ao=20inv=C3=A9s=20de=20sigla=20no=20LexML?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/lexml/OAIServer.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sapl/lexml/OAIServer.py b/sapl/lexml/OAIServer.py index 8895fea46..cf85e4bf8 100644 --- a/sapl/lexml/OAIServer.py +++ b/sapl/lexml/OAIServer.py @@ -11,6 +11,7 @@ from lxml.builder import ElementMaker from sapl.base.models import AppConfig, CasaLegislativa from sapl.lexml.models import LexmlPublicador, LexmlProvedor from sapl.norma.models import NormaJuridica +from sapl.utils import LISTA_DE_UFS class OAILEXML: @@ -127,17 +128,18 @@ class OAIServer: urn = 'urn:lex:br;' esferas = {'M': 'municipal', 'E': 'estadual'} municipio = casa.municipio.lower() - uf = casa.uf.lower() + uf_map = dict(LISTA_DE_UFS) + uf_desc = uf_map.get(casa.uf.upper(), '').lower() for x in [' ', '.de.', '.da.', '.das.', '.do.', '.dos.']: municipio = municipio.replace(x, '.') - uf = uf.replace(x, '.') + uf_desc = uf_desc.replace(x, '.') if esfera == 'M': - urn += '{};{}:'.format(uf, municipio) + urn += '{};{}:'.format(uf_desc, municipio) if norma.tipo.equivalente_lexml == 'regimento.interno' or norma.tipo.equivalente_lexml == 'resolucao': urn += 'camara.' urn += esferas[esfera] + ':' elif esfera == 'E': - urn += '{}:{}:'.format(uf, esferas[esfera]) + urn += '{}:{}:'.format(uf_desc, esferas[esfera]) else: urn += ':' if norma.tipo.equivalente_lexml: From b100694cdae448d9cb1c670e74886299a67a76d0 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Tue, 16 Apr 2019 14:59:51 -0300 Subject: [PATCH 2/2] HOT-FIX: corrige erro de pk em LexML --- sapl/lexml/OAIServer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sapl/lexml/OAIServer.py b/sapl/lexml/OAIServer.py index cf85e4bf8..4964dbeb9 100644 --- a/sapl/lexml/OAIServer.py +++ b/sapl/lexml/OAIServer.py @@ -191,13 +191,13 @@ class OAIServer: else: formato = 'text/html' url_conteudo = BASE_URL_SAPL + reverse('sapl.norma:normajuridica_detail', - kwargs={'pk': norma.numero}) + kwargs={'pk': norma.pk}) element_maker = ElementMaker() id_publicador = str(publicador.id_publicador) item_conteudo = element_maker.Item(url_conteudo, formato=formato, idPublicador=id_publicador, tipo='conteudo') oai_lexml.append(item_conteudo) - url = BASE_URL_SAPL + reverse('sapl.norma:normajuridica_detail', kwargs={'pk': norma.numero}) + url = BASE_URL_SAPL + reverse('sapl.norma:normajuridica_detail', kwargs={'pk': norma.pk}) item_metadado = element_maker.Item(url, formato='text/html', idPublicador=id_publicador, tipo='metadado') oai_lexml.append(item_metadado) documento_individual = element_maker.DocumentoIndividual(urn)