Skip to content
This repository has been archived by the owner on Aug 7, 2018. It is now read-only.

Commit

Permalink
Evita logs repetidos no importador cdep.
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardofl committed May 18, 2018
1 parent c74a607 commit 4599dcf
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions radar_parlamentar/importadores/cdep.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ def __init__(self, camaraws=Camaraws()):
self.proposicoes = self._init_proposicoes()
self.votacoes = self._init_votacoes()
self.camaraws = camaraws
self.opcoes_voto_desconhecidas = []
self.partidos_desconhecidos = []

def _gera_casa_legislativa(self):
"""Gera objeto do tipo CasaLegislativa
Expand Down Expand Up @@ -456,9 +458,11 @@ def voto_art17():
return models.ABSTENCAO

def default():
logger.warning(
'opção de voto "%s" desconhecido! Mapeado como ABSTENCAO'
% voto)
if not voto in self.opcoes_voto_desconhecidas:
self.opcoes_voto_desconhecidas.append(voto)
logger.warning(
'opção de voto "%s" desconhecido! Mapeado como ABSTENCAO'
% voto)
return models.ABSTENCAO

dict = {'Não': voto_nao,
Expand Down Expand Up @@ -491,8 +495,10 @@ def _deputado(self, voto_xml):
parlamentar.casa_legislativa = self.camara_dos_deputados
parlamentar.save()
if partido.numero == 0:
logger.warn('Não achou o partido %s' % nome_partido)
logger.info('Deputado %s inserido sem partido' % nome)
if not nome_partido in self.partidos_desconhecidos:
self.partidos_desconhecidos.append(nome_partido)
logger.warn('Não achou o partido %s. Mapeado como "sem partido"'
% nome_partido)
self.parlamentares[key] = parlamentar
return parlamentar

Expand Down

0 comments on commit 4599dcf

Please sign in to comment.