From 383e956ae619b7424b3af8250ec96bcc5f2731f7 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Mon, 15 Apr 2019 19:01:53 -0300 Subject: [PATCH] HOT-FIX: conserta URLs LexML --- sapl/lexml/OAIServer.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sapl/lexml/OAIServer.py b/sapl/lexml/OAIServer.py index 7972e709a..8895fea46 100644 --- a/sapl/lexml/OAIServer.py +++ b/sapl/lexml/OAIServer.py @@ -166,6 +166,9 @@ class OAIServer: return '' def monta_xml(self, urn, norma): + BASE_URL_SAPL = self.config['base_url'] + BASE_URL_SAPL = BASE_URL_SAPL[:BASE_URL_SAPL.find('/', 8)] + publicador = LexmlPublicador.objects.first() if norma and publicador: LEXML = ElementMaker(namespace=self.ns['lexml'], nsmap=self.ns) @@ -178,20 +181,21 @@ class OAIServer: 'odt': 'application/vnd.oasis.opendocument.text', 'pdf': 'application/pdf', 'rtf': 'application/rtf'} + if texto_integral: - url_conteudo = self.config['base_url'] + texto_integral.url + url_conteudo = BASE_URL_SAPL + texto_integral.url extensao = texto_integral.url.split('.')[-1] formato = mime_types.get(extensao, 'application/octet-stream') else: formato = 'text/html' - url_conteudo = self.config['base_url'] + reverse('sapl.norma:normajuridica_detail', + url_conteudo = BASE_URL_SAPL + reverse('sapl.norma:normajuridica_detail', kwargs={'pk': norma.numero}) 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 = self.config['base_url'] + reverse('sapl.norma:normajuridica_detail', kwargs={'pk': norma.numero}) + url = BASE_URL_SAPL + reverse('sapl.norma:normajuridica_detail', kwargs={'pk': norma.numero}) 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)