Browse Source

HOTFIX - correcao no codigo do username utilizado nos loggings

pull/2365/head
Cesar Carvalho 6 years ago
parent
commit
fe4f9b7724
  1. 52
      sapl/materia/views.py

52
sapl/materia/views.py

@ -95,7 +95,7 @@ def autores_ja_adicionados(materia_pk):
def proposicao_texto(request, pk): def proposicao_texto(request, pk):
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
username = request.user.username.replace("'", "") username = request.user.username
logger.debug('user=' + username + logger.debug('user=' + username +
'. Tentando obter objeto Proposicao com pk = {}.'.format(pk)) '. Tentando obter objeto Proposicao com pk = {}.'.format(pk))
proposicao = Proposicao.objects.get(pk=pk) proposicao = Proposicao.objects.get(pk=pk)
@ -184,7 +184,7 @@ class CriarProtocoloMateriaView(CreateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super( context = super(
CriarProtocoloMateriaView, self).get_context_data(**kwargs) CriarProtocoloMateriaView, self).get_context_data(**kwargs)
username = self.request.user.username.replace("'", "") username = self.request.user.username
try: try:
self.logger.debug("user=" + username + self.logger.debug("user=" + username +
@ -219,7 +219,7 @@ class CriarProtocoloMateriaView(CreateView):
def form_valid(self, form): def form_valid(self, form):
materia = form.save() materia = form.save()
username = self.request.user.username.replace("'", "") username = self.request.user.username
try: try:
self.logger.info( self.logger.info(
@ -312,7 +312,7 @@ class ProposicaoTaView(IntegracaoTaView):
@permission_required('materia.detail_materialegislativa') @permission_required('materia.detail_materialegislativa')
def recuperar_materia(request): def recuperar_materia(request):
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
username = request.user.username.replace("'", "") username = request.user.username
tipo = TipoMateriaLegislativa.objects.get(pk=request.GET['tipo']) tipo = TipoMateriaLegislativa.objects.get(pk=request.GET['tipo'])
ano = request.GET.get('ano', '') ano = request.GET.get('ano', '')
@ -563,7 +563,7 @@ class RetornarProposicao(UpdateView):
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
username = request.user.username.replace("'", "") username = request.user.username
try: try:
self.logger.info( self.logger.info(
"user=" + username + ". Tentando obter objeto Proposicao com id={}.".format(kwargs['pk'])) "user=" + username + ". Tentando obter objeto Proposicao com id={}.".format(kwargs['pk']))
@ -603,7 +603,7 @@ class ConfirmarProposicao(PermissionRequiredForAppCrudMixin, UpdateView):
return self.object.results['url'] return self.object.results['url']
def get_object(self, queryset=None): def get_object(self, queryset=None):
username = self.request.user.username.replace("'", "") username = self.request.user.username
try: try:
""" """
@ -764,7 +764,7 @@ class ProposicaoCrud(Crud):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
action = request.GET.get('action', '') action = request.GET.get('action', '')
username = request.user.username.replace("'", "") username = request.user.username
if not action: if not action:
return Crud.DetailView.get(self, request, *args, **kwargs) return Crud.DetailView.get(self, request, *args, **kwargs)
@ -849,7 +849,7 @@ class ProposicaoCrud(Crud):
kwargs={'pk': kwargs['pk']})) kwargs={'pk': kwargs['pk']}))
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
username = request.user.username.replace("'", "") username = request.user.username
try: try:
self.logger.debug( self.logger.debug(
"user=" + username + ". Tentando obter objeto Proposicao com pk={}".format(kwargs['pk'])) "user=" + username + ". Tentando obter objeto Proposicao com pk={}".format(kwargs['pk']))
@ -892,7 +892,7 @@ class ProposicaoCrud(Crud):
id=kwargs['pk']).values_list( id=kwargs['pk']).values_list(
'data_envio', 'data_recebimento') 'data_envio', 'data_recebimento')
username = request.user.username.replace("'", "") username = request.user.username
if proposicao: if proposicao:
if proposicao[0][0] and proposicao[0][1]: if proposicao[0][0] and proposicao[0][1]:
@ -923,7 +923,7 @@ class ProposicaoCrud(Crud):
id=kwargs['pk']).values_list( id=kwargs['pk']).values_list(
'data_envio', 'data_recebimento') 'data_envio', 'data_recebimento')
username = request.user.username.replace("'", "") username = request.user.username
if proposicao: if proposicao:
if proposicao[0][0] and proposicao[0][1]: if proposicao[0][0] and proposicao[0][1]:
@ -947,7 +947,7 @@ class ProposicaoCrud(Crud):
def get_success_url(self): def get_success_url(self):
tipo_texto = self.request.POST.get('tipo_texto', '') tipo_texto = self.request.POST.get('tipo_texto', '')
username = self.request.user.username.replace("'", "") username = self.request.user.username
if tipo_texto == 'T': if tipo_texto == 'T':
messages.info(self.request, messages.info(self.request,
@ -977,7 +977,7 @@ class ProposicaoCrud(Crud):
def get_success_url(self): def get_success_url(self):
tipo_texto = self.request.POST.get('tipo_texto', '') tipo_texto = self.request.POST.get('tipo_texto', '')
username = self.request.user.username.replace("'", "") username = self.request.user.username
if tipo_texto == 'T': if tipo_texto == 'T':
messages.info(self.request, messages.info(self.request,
@ -1060,7 +1060,7 @@ class ReciboProposicaoView(TemplateView):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
proposicao = Proposicao.objects.get(pk=self.kwargs['pk']) proposicao = Proposicao.objects.get(pk=self.kwargs['pk'])
username = request.user.username.replace("'", "") username = request.user.username
if proposicao.data_envio: if proposicao.data_envio:
return TemplateView.get(self, request, *args, **kwargs) return TemplateView.get(self, request, *args, **kwargs)
@ -1091,7 +1091,7 @@ class RelatoriaCrud(MasterDetailCrud):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
username = self.request.user.username.replace("'", "") username = self.request.user.username
try: try:
self.logger.debug("user=" + username + ". Tentando obter objeto Comissao de pk={}.".format( self.logger.debug("user=" + username + ". Tentando obter objeto Comissao de pk={}.".format(
@ -1146,7 +1146,7 @@ class RelatoriaCrud(MasterDetailCrud):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
username = self.request.user.username.replace("'", "") username = self.request.user.username
try: try:
self.logger.debug("user=" + username + ". Tentando obter objeto Comissao de pk={}.".format( self.logger.debug("user=" + username + ". Tentando obter objeto Comissao de pk={}.".format(
@ -1210,7 +1210,7 @@ class TramitacaoCrud(MasterDetailCrud):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
username = self.request.user.username.replace("'", "") username = self.request.user.username
ultima_tramitacao = Tramitacao.objects.filter( ultima_tramitacao = Tramitacao.objects.filter(
materia_id=self.kwargs['pk']).order_by( materia_id=self.kwargs['pk']).order_by(
@ -1236,7 +1236,7 @@ class TramitacaoCrud(MasterDetailCrud):
def form_valid(self, form): def form_valid(self, form):
self.object = form.save() self.object = form.save()
username = self.request.user.username.replace("'", "") username = self.request.user.username
if form.instance.status.indicador == 'F': if form.instance.status.indicador == 'F':
form.instance.materia.em_tramitacao = False form.instance.materia.em_tramitacao = False
@ -1270,7 +1270,7 @@ class TramitacaoCrud(MasterDetailCrud):
def form_valid(self, form): def form_valid(self, form):
self.object = form.save() self.object = form.save()
username = self.request.user.username.replace("'", "") username = self.request.user.username
if form.instance.status.indicador == 'F': if form.instance.status.indicador == 'F':
form.instance.materia.em_tramitacao = False form.instance.materia.em_tramitacao = False
@ -1320,7 +1320,7 @@ class TramitacaoCrud(MasterDetailCrud):
'-timestamp', '-timestamp',
'-id').first() '-id').first()
username = request.user.username.replace("'", "") username = request.user.username
if tramitacao.pk != ultima_tramitacao.pk: if tramitacao.pk != ultima_tramitacao.pk:
self.logger.error("user=" + username + ". Não é possível deletar a tramitação de pk={}. " self.logger.error("user=" + username + ". Não é possível deletar a tramitação de pk={}. "
@ -1669,7 +1669,7 @@ class AcompanhamentoConfirmarView(TemplateView):
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
def get_redirect_url(self, email): def get_redirect_url(self, email):
username = self.request.user.username.replace("'", "") username = self.request.user.username
self.logger.debug( self.logger.debug(
'user=' + username + '. Esta matéria está sendo acompanhada pelo e-mail: %s' % (email)) 'user=' + username + '. Esta matéria está sendo acompanhada pelo e-mail: %s' % (email))
msg = _('Esta matéria está sendo acompanhada pelo e-mail: %s') % ( msg = _('Esta matéria está sendo acompanhada pelo e-mail: %s') % (
@ -1681,7 +1681,7 @@ class AcompanhamentoConfirmarView(TemplateView):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
materia_id = kwargs['pk'] materia_id = kwargs['pk']
hash_txt = request.GET.get('hash_txt', '') hash_txt = request.GET.get('hash_txt', '')
username = self.request.user.username.replace("'", "") username = self.request.user.username
try: try:
self.logger.info("user=" + username + ". Tentando obter objeto AcompanhamentoMateria (materia_id={}, hash={})." self.logger.info("user=" + username + ". Tentando obter objeto AcompanhamentoMateria (materia_id={}, hash={})."
@ -1710,7 +1710,7 @@ class AcompanhamentoExcluirView(TemplateView):
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
def get_success_url(self): def get_success_url(self):
username = self.request.user.username.replace("'", "") username = self.request.user.username
self.logger.debug("user=" + username + self.logger.debug("user=" + username +
". Você parou de acompanhar esta matéria.") ". Você parou de acompanhar esta matéria.")
msg = _('Você parou de acompanhar esta matéria.') msg = _('Você parou de acompanhar esta matéria.')
@ -1721,7 +1721,7 @@ class AcompanhamentoExcluirView(TemplateView):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
materia_id = kwargs['pk'] materia_id = kwargs['pk']
hash_txt = request.GET.get('hash_txt', '') hash_txt = request.GET.get('hash_txt', '')
username = self.request.user.username.replace("'", "") username = self.request.user.username
try: try:
self.logger.info("user=" + username + ". Tentando deletar objeto AcompanhamentoMateria (materia_id={}, hash={})." self.logger.info("user=" + username + ". Tentando deletar objeto AcompanhamentoMateria (materia_id={}, hash={})."
@ -2018,7 +2018,7 @@ class PrimeiraTramitacaoEmLoteView(PermissionRequiredMixin, FilterView):
tz = timezone.get_current_timezone() tz = timezone.get_current_timezone()
username = request.user.username.replace("'", "") username = request.user.username
if len(marcadas) == 0: if len(marcadas) == 0:
msg = _('Nenhuma máteria foi selecionada.') msg = _('Nenhuma máteria foi selecionada.')
@ -2233,7 +2233,7 @@ class FichaSelecionaView(PermissionRequiredMixin, FormView):
context['form'].fields['materia'].choices = [ context['form'].fields['materia'].choices = [
(m.id, str(m)) for m in materia_list] (m.id, str(m)) for m in materia_list]
username = self.request.user.username.replace("'", "") username = self.request.user.username
if context['quantidade'] > 100: if context['quantidade'] > 100:
self.logger.info('user=' + username + '. Sua pesquisa (tipo={}, data_inicial={}, data_final={}) retornou mais do que ' self.logger.info('user=' + username + '. Sua pesquisa (tipo={}, data_inicial={}, data_final={}) retornou mais do que '
@ -2253,7 +2253,7 @@ class FichaSelecionaView(PermissionRequiredMixin, FormView):
def form_valid(self, form): def form_valid(self, form):
context = {} context = {}
username = self.request.user.username.replace("'", "") username = self.request.user.username
try: try:
self.logger.debug( self.logger.debug(

Loading…
Cancel
Save