Browse Source

Adiciona XML do Provedor

pull/2582/head
Edward Ribeiro 6 years ago
parent
commit
8b08523758
  1. 14
      sapl/lexml/OAIServer.py

14
sapl/lexml/OAIServer.py

@ -9,7 +9,7 @@ from lxml import etree
from lxml.builder import ElementMaker from lxml.builder import ElementMaker
from sapl.base.models import AppConfig, CasaLegislativa from sapl.base.models import AppConfig, CasaLegislativa
from sapl.lexml.models import LexmlPublicador from sapl.lexml.models import LexmlPublicador, LexmlProvedor
from sapl.norma.models import NormaJuridica from sapl.norma.models import NormaJuridica
@ -257,6 +257,16 @@ def casa_legislativa():
return casa if casa else CasaLegislativa() # retorna objeto dummy return casa if casa else CasaLegislativa() # retorna objeto dummy
def get_xml_provedor():
""" antigo get_descricao_casa() """
descricao = ''
provedor = LexmlProvedor.objects.first()
if provedor:
descricao = provedor.xml
if descricao:
descricao = descricao.encode('utf-8')
return descricao
def get_config(url, batch_size): def get_config(url, batch_size):
config = {'content_type': None, config = {'content_type': None,
'delay': 0, 'delay': 0,
@ -265,7 +275,7 @@ def get_config(url, batch_size):
config.update({'titulo': casa_legislativa().nome, # Inicializa variável global casa config.update({'titulo': casa_legislativa().nome, # Inicializa variável global casa
'email': [casa.email], # lista de e-mails 'email': [casa.email], # lista de e-mails
'base_url': url[:url.find('/', 8)], 'base_url': url[:url.find('/', 8)],
'descricao': casa.informacao_geral, 'descricao': get_xml_provedor(),
'batch_size': batch_size}) 'batch_size': batch_size})
return config return config

Loading…
Cancel
Save