From 39d0645c923beab7ffa940007e9bd6753c07921a Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Mon, 10 Apr 2017 11:22:30 -0300 Subject: [PATCH] Conserta erros de QA --- sapl/base/search_indexes.py | 3 ++- .../templatetags/compilacao_filters.py | 3 ++- sapl/crispy_layout_mixin.py | 2 +- sapl/crud/base.py | 2 +- sapl/legacy/migration.py | 2 +- sapl/materia/models.py | 3 +-- sapl/materia/signals.py | 7 +++--- sapl/materia/urls.py | 7 +++--- sapl/materia/views.py | 24 +++++++++---------- sapl/norma/models.py | 4 ++-- sapl/norma/signals.py | 5 ++-- sapl/norma/views.py | 1 + sapl/parlamentares/views.py | 1 - sapl/protocoloadm/forms.py | 4 ++-- sapl/relatorios/views.py | 11 ++++----- sapl/sessao/views.py | 4 ++-- 16 files changed, 41 insertions(+), 42 deletions(-) diff --git a/sapl/base/search_indexes.py b/sapl/base/search_indexes.py index 1b2944f48..c85be523b 100644 --- a/sapl/base/search_indexes.py +++ b/sapl/base/search_indexes.py @@ -1,8 +1,9 @@ import os.path -import textract +import textract from django.template import Context, loader from haystack import indexes + from sapl.materia.models import DocumentoAcessorio, MateriaLegislativa from sapl.norma.models import NormaJuridica diff --git a/sapl/compilacao/templatetags/compilacao_filters.py b/sapl/compilacao/templatetags/compilacao_filters.py index f3965c43d..941ec5fe1 100644 --- a/sapl/compilacao/templatetags/compilacao_filters.py +++ b/sapl/compilacao/templatetags/compilacao_filters.py @@ -211,7 +211,7 @@ def heranca(request, d, ignore_ultimo=0, ignore_primeiro=0): ta_id = str(d.ta_id) d_pk = str(d.pk) if ta_id not in ta_dpts_parents or d_pk not in ta_dpts_parents[ta_id]: - #print('recarregando estrutura temporaria de heranças') + # print('recarregando estrutura temporaria de heranças') dpts_parents = {} ta_dpts_parents[ta_id] = dpts_parents update_dispositivos_parents(dpts_parents, ta_id) @@ -296,6 +296,7 @@ def urldetail_content_type(obj): def list(obj): return [obj, ] + @register.filter def can_use_dynamic_editing(texto_articulado, user): return texto_articulado.can_use_dynamic_editing(user) diff --git a/sapl/crispy_layout_mixin.py b/sapl/crispy_layout_mixin.py index e9dbc3f01..369b6fe9e 100644 --- a/sapl/crispy_layout_mixin.py +++ b/sapl/crispy_layout_mixin.py @@ -1,12 +1,12 @@ from math import ceil +import rtyaml from crispy_forms.bootstrap import FormActions from crispy_forms.helper import FormHelper from crispy_forms.layout import HTML, Div, Fieldset, Layout, Submit from django import template from django.utils import formats from django.utils.translation import ugettext as _ -import rtyaml def heads_and_tails(list_of_lists): diff --git a/sapl/crud/base.py b/sapl/crud/base.py index b2223c31f..1a1225cfc 100644 --- a/sapl/crud/base.py +++ b/sapl/crud/base.py @@ -842,7 +842,7 @@ class CrudDeleteView(PermissionRequiredContainerCrudMixin, def delete(self, request, *args, **kwargs): try: - return super(CrudDeleteView, self).delete(request, args, kwargs) + return super(CrudDeleteView, self).delete(request, args, kwargs) except models.ProtectedError as err: error_msg = 'Registro não pode ser removido, pois\ é referenciado por outros registros:
\ diff --git a/sapl/legacy/migration.py b/sapl/legacy/migration.py index 99d14f8a7..ef87a3960 100644 --- a/sapl/legacy/migration.py +++ b/sapl/legacy/migration.py @@ -19,7 +19,7 @@ from model_mommy.mommy import foreign_key_required, make from sapl.base.models import Autor, ProblemaMigracao from sapl.comissoes.models import Comissao, Composicao, Participacao from sapl.legacy.models import Protocolo as ProtocoloLegado -from sapl.materia.models import (Proposicao, StatusTramitacao, TipoDocumento, +from sapl.materia.models import (StatusTramitacao, TipoDocumento, TipoMateriaLegislativa, TipoProposicao, Tramitacao) from sapl.norma.models import (AssuntoNorma, NormaJuridica, diff --git a/sapl/materia/models.py b/sapl/materia/models.py index 6b48613ee..1a9d2afff 100644 --- a/sapl/materia/models.py +++ b/sapl/materia/models.py @@ -1,5 +1,6 @@ from datetime import datetime +import reversion from django.contrib.auth.models import Group from django.contrib.contenttypes.fields import GenericRelation from django.contrib.contenttypes.models import ContentType @@ -7,7 +8,6 @@ from django.db import models from django.utils import formats from django.utils.translation import ugettext_lazy as _ from model_utils import Choices -import reversion from sapl.base.models import Autor from sapl.comissoes.models import Comissao @@ -18,7 +18,6 @@ from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, SaplGenericForeignKey, SaplGenericRelation, restringe_tipos_de_arquivo_txt, texto_upload_path) - EM_TRAMITACAO = [(1, 'Sim'), (0, 'Não')] diff --git a/sapl/materia/signals.py b/sapl/materia/signals.py index 96ff85dea..d913e9cd8 100644 --- a/sapl/materia/signals.py +++ b/sapl/materia/signals.py @@ -1,10 +1,11 @@ -from django.db.models.signals import post_delete, post_save -from sapl.settings import PROJECT_DIR from subprocess import PIPE, call from threading import Thread +from django.db.models.signals import post_delete, post_save + +from sapl.settings import PROJECT_DIR -from .models import MateriaLegislativa, DocumentoAcessorio +from .models import DocumentoAcessorio, MateriaLegislativa class UpdateIndexCommand(Thread): diff --git a/sapl/materia/urls.py b/sapl/materia/urls.py index 1de8cd689..7eac42e5c 100644 --- a/sapl/materia/urls.py +++ b/sapl/materia/urls.py @@ -4,10 +4,9 @@ from sapl.materia.views import (AcompanhamentoConfirmarView, AcompanhamentoExcluirView, AcompanhamentoMateriaView, AdicionarVariasAutorias, AnexadaCrud, - AssuntoMateriaCrud, - AutoriaCrud, ConfirmarProposicao, - CriarProtocoloMateriaView, DespachoInicialCrud, - DocumentoAcessorioCrud, + AssuntoMateriaCrud, AutoriaCrud, + ConfirmarProposicao, CriarProtocoloMateriaView, + DespachoInicialCrud, DocumentoAcessorioCrud, DocumentoAcessorioEmLoteView, LegislacaoCitadaCrud, MateriaAssuntoCrud, MateriaLegislativaCrud, diff --git a/sapl/materia/views.py b/sapl/materia/views.py index 305b4b7b0..b93d81289 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -43,21 +43,19 @@ from sapl.utils import (TURNO_TRAMITACAO_CHOICES, YES_NO_CHOICES, autor_label, from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm, AdicionarVariasAutoriasFilterSet, DespachoInicialForm, - DocumentoAcessorioForm, - MateriaAssuntoForm, MateriaLegislativaFilterSet, - MateriaSimplificadaForm, PrimeiraTramitacaoEmLoteFilterSet, - ReceberProposicaoForm, RelatoriaForm, - TramitacaoEmLoteFilterSet, filtra_tramitacao_destino, + DocumentoAcessorioForm, MateriaAssuntoForm, + MateriaLegislativaFilterSet, MateriaSimplificadaForm, + PrimeiraTramitacaoEmLoteFilterSet, ReceberProposicaoForm, + RelatoriaForm, TramitacaoEmLoteFilterSet, + filtra_tramitacao_destino, filtra_tramitacao_destino_and_status, filtra_tramitacao_status) -from .models import (AssuntoMateria, AcompanhamentoMateria, - Anexada, Autoria, DespachoInicial, - DocumentoAcessorio, MateriaLegislativa, - MateriaAssunto, Numeracao, Orgao, - Origem, Proposicao, RegimeTramitacao, Relatoria, - StatusTramitacao, TipoDocumento, TipoFimRelatoria, - TipoMateriaLegislativa, TipoProposicao, Tramitacao, - UnidadeTramitacao) +from .models import (AcompanhamentoMateria, Anexada, AssuntoMateria, Autoria, + DespachoInicial, DocumentoAcessorio, MateriaAssunto, + MateriaLegislativa, Numeracao, Orgao, Origem, Proposicao, + RegimeTramitacao, Relatoria, StatusTramitacao, + TipoDocumento, TipoFimRelatoria, TipoMateriaLegislativa, + TipoProposicao, Tramitacao, UnidadeTramitacao) AssuntoMateriaCrud = Crud.build(AssuntoMateria, 'assunto_materia') diff --git a/sapl/norma/models.py b/sapl/norma/models.py index 20b59956f..d91ee2da2 100644 --- a/sapl/norma/models.py +++ b/sapl/norma/models.py @@ -7,8 +7,8 @@ from model_utils import Choices from sapl.compilacao.models import TextoArticulado from sapl.materia.models import MateriaLegislativa -from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, texto_upload_path, - restringe_tipos_de_arquivo_txt) +from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, + restringe_tipos_de_arquivo_txt, texto_upload_path) @reversion.register() diff --git a/sapl/norma/signals.py b/sapl/norma/signals.py index fc16f89b4..20d405e49 100644 --- a/sapl/norma/signals.py +++ b/sapl/norma/signals.py @@ -1,8 +1,9 @@ -from django.db.models.signals import post_delete, post_save -from sapl.settings import PROJECT_DIR from subprocess import PIPE, call from threading import Thread +from django.db.models.signals import post_delete, post_save + +from sapl.settings import PROJECT_DIR from .models import NormaJuridica diff --git a/sapl/norma/views.py b/sapl/norma/views.py index 461c1b9ef..9120da4e9 100644 --- a/sapl/norma/views.py +++ b/sapl/norma/views.py @@ -4,6 +4,7 @@ from django.http import JsonResponse from django.utils.translation import ugettext_lazy as _ from django.views.generic.base import RedirectView from django_filters.views import FilterView + from sapl.base.models import AppConfig from sapl.compilacao.views import IntegracaoTaView from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud, CrudAux, diff --git a/sapl/parlamentares/views.py b/sapl/parlamentares/views.py index a4f698b5a..d703e1c2c 100644 --- a/sapl/parlamentares/views.py +++ b/sapl/parlamentares/views.py @@ -22,7 +22,6 @@ from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa, NivelInstrucao, Parlamentar, Partido, SessaoLegislativa, SituacaoMilitar, TipoAfastamento, TipoDependente, Votante) - CargoMesaCrud = CrudAux.build(CargoMesa, 'cargo_mesa') PartidoCrud = CrudAux.build(Partido, 'partidos') SessaoLegislativaCrud = CrudAux.build(SessaoLegislativa, 'sessao_legislativa') diff --git a/sapl/protocoloadm/forms.py b/sapl/protocoloadm/forms.py index bca51df31..d8f996fe3 100644 --- a/sapl/protocoloadm/forms.py +++ b/sapl/protocoloadm/forms.py @@ -544,10 +544,10 @@ class DocumentoAdministrativoForm(ModelForm): ano_protocolo = forms.ChoiceField(required=False, label=Protocolo._meta. - get_field('ano').verbose_name, + get_field('ano').verbose_name, choices=RANGE_ANOS, widget=forms.Select( - attrs={'class': 'selector'})) + attrs={'class': 'selector'})) class Meta: model = DocumentoAdministrativo diff --git a/sapl/relatorios/views.py b/sapl/relatorios/views.py index 53b9ef54b..9e482abda 100644 --- a/sapl/relatorios/views.py +++ b/sapl/relatorios/views.py @@ -8,15 +8,14 @@ from sapl.base.models import Autor, CasaLegislativa from sapl.comissoes.models import Comissao from sapl.materia.models import (Autoria, MateriaLegislativa, Numeracao, Tramitacao, UnidadeTramitacao) -from sapl.parlamentares.models import (CargoMesa, ComposicaoMesa, Filiacao, - Parlamentar) +from sapl.parlamentares.models import CargoMesa, Filiacao, Parlamentar from sapl.protocoloadm.models import (DocumentoAdministrativo, Protocolo, TramitacaoAdministrativo) from sapl.sessao.models import (ExpedienteMateria, ExpedienteSessao, - IntegranteMesa, Orador, - OradorExpediente, OrdemDia, PresencaOrdemDia, - RegistroVotacao, SessaoPlenaria, - SessaoPlenariaPresenca, TipoExpediente) + IntegranteMesa, Orador, OradorExpediente, + OrdemDia, PresencaOrdemDia, RegistroVotacao, + SessaoPlenaria, SessaoPlenariaPresenca, + TipoExpediente) from sapl.settings import STATIC_ROOT from sapl.utils import UF diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index fedc8829e..e56cb749e 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -604,7 +604,7 @@ class PainelView(PermissionRequiredForAppCrudMixin, TemplateView): cronometro_ordem = AppsAppConfig.attr('cronometro_ordem') if (not cronometro_discurso or not cronometro_aparte - or not cronometro_ordem): + or not cronometro_ordem): msg = _( 'Você precisa primeiro configurar os cronômetros \ nas Configurações da Aplicação') @@ -2436,7 +2436,7 @@ def mudar_ordem_materia_sessao(request): sessao_plenaria=pk_sessao, numero_ordem=posicao_inicial) except ObjectDoesNotExist: - raise # TODO tratar essa exceção + raise # TODO tratar essa exceção # Se a posição inicial for menor que a final, todos que # estiverem acima da nova posição devem ter sua ordem decrementada