From 6cecfeb16a33ffd72560f79d628824805e760e2d Mon Sep 17 00:00:00 2001 From: LeandroRoberto Date: Thu, 8 Sep 2016 13:03:59 -0300 Subject: [PATCH] Corrige erro na constr da Arvore temp de Disptvs --- sapl/compilacao/templatetags/compilacao_filters.py | 6 ++++-- sapl/compilacao/views.py | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sapl/compilacao/templatetags/compilacao_filters.py b/sapl/compilacao/templatetags/compilacao_filters.py index b81d16e16..bd45fb475 100644 --- a/sapl/compilacao/templatetags/compilacao_filters.py +++ b/sapl/compilacao/templatetags/compilacao_filters.py @@ -7,6 +7,7 @@ from django.utils.translation import ugettext_lazy as _ from sapl.compilacao.models import Dispositivo + register = template.Library() @@ -214,7 +215,9 @@ def heranca(request, d, ignore_ultimo=0, ignore_primeiro=0): ta_dpts_parents = {} ta_id = str(d.ta_id) - if ta_id not in ta_dpts_parents: + 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') dpts_parents = {} ta_dpts_parents[ta_id] = dpts_parents update_dispositivos_parents(dpts_parents, ta_id) @@ -231,7 +234,6 @@ def heranca(request, d, ignore_ultimo=0, ignore_primeiro=0): request.session['herancas_fila'] = herancas_fila request.session['herancas'] = ta_dpts_parents - d_pk = str(d.pk) h = ta_dpts_parents[ta_id][d_pk]['h'] if h: diff --git a/sapl/compilacao/views.py b/sapl/compilacao/views.py index 1d913c0df..847502316 100644 --- a/sapl/compilacao/views.py +++ b/sapl/compilacao/views.py @@ -2599,7 +2599,10 @@ class DispositivoSearchFragmentFormView(ListView): q = q & Q(**{ 'ta__texto_articulado__' + column_field: tipo_model.pk }) - result = result.filter(q)[:n] + if n: + result = result.filter(q)[:n] + else: + result = result.filter(q) for d in result: if not d.ta.content_object or\