From 243f984a13a60ef441daff8fef9dc8603be773a1 Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Sun, 6 Jan 2019 16:21:20 -0200 Subject: [PATCH] remove django-compressor --- requirements/requirements.txt | 11 ++++++----- sapl/base/templatetags/common_tags.py | 15 ++++++++++----- sapl/crud/base.py | 15 +++++++++------ setup.py | 9 +++++---- 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 69cb803f5..944b300d7 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,13 +1,12 @@ django>=1.11,<2.0 -django-haystack==2.8.1 django-bootstrap3==11.0.0 +django-haystack==2.8.1 django-filter==2.0.0 djangorestframework==3.9.0 - -dj-database-url==0.4.1 +dj-database-url==0.5.0 django-bower==5.2.0 django-braces==1.9.0 -django-compressor==2.0 + django-crispy-forms==1.6.1 django-extensions==1.9.8 django-extra-views==0.11.0 @@ -35,4 +34,6 @@ django-reversion-compare==0.8.4 #git+git://github.com/interlegis/trml2pdf.git #git+git://github.com/jasperlittle/django-rest-framework-docs -#git+git://github.com/rubgombar1/django-admin-bootstrapped.git \ No newline at end of file +#git+git://github.com/rubgombar1/django-admin-bootstrapped.git + +#django-compressor==2.2 \ No newline at end of file diff --git a/sapl/base/templatetags/common_tags.py b/sapl/base/templatetags/common_tags.py index 89f781558..884a6968f 100644 --- a/sapl/base/templatetags/common_tags.py +++ b/sapl/base/templatetags/common_tags.py @@ -1,8 +1,4 @@ -import logging - -from compressor.utils import get_class from django import template -from django.conf import settings from django.template.defaultfilters import stringfilter from sapl.base.models import AppConfig @@ -15,6 +11,15 @@ from sapl.utils import filiacao_data, SEPARADOR_HASH_PROPOSICAO register = template.Library() +def get_class(class_string): + if not hasattr(class_string, '__bases__'): + class_string = str(class_string) + dot = class_string.rindex('.') + mod_name, class_name = class_string[:dot], class_string[dot + 1:] + if class_name: + return getattr(__import__(mod_name, {}, {}, [str('')]), class_name) + + @register.simple_tag def define(arg): return arg @@ -228,7 +233,7 @@ def file_extension(value): def cronometro_to_seconds(value): if not AppConfig.attr('cronometro_' + value): return 0 - + return AppConfig.attr('cronometro_' + value).seconds diff --git a/sapl/crud/base.py b/sapl/crud/base.py index e720b36cd..faa0e1287 100644 --- a/sapl/crud/base.py +++ b/sapl/crud/base.py @@ -1,6 +1,6 @@ import logging + from braces.views import FormMessagesMixin -from compressor.utils.decorators import cached_property from crispy_forms.bootstrap import FieldWithButtons, StrictButton from crispy_forms.helper import FormHelper from crispy_forms.layout import Field, Layout @@ -16,6 +16,7 @@ from django.http.response import Http404 from django.shortcuts import redirect from django.utils.decorators import classonlymethod from django.utils.encoding import force_text +from django.utils.functional import cached_property from django.utils.translation import string_concat from django.utils.translation import ugettext_lazy as _ from django.views.generic import (CreateView, DeleteView, DetailView, ListView, @@ -29,6 +30,7 @@ from sapl.rules.map_rules import (RP_ADD, RP_CHANGE, RP_DELETE, RP_DETAIL, from sapl.settings import BASE_DIR from sapl.utils import normalize + ACTION_LIST, ACTION_CREATE, ACTION_DETAIL, ACTION_UPDATE, ACTION_DELETE = \ 'list', 'create', 'detail', 'update', 'delete' @@ -558,7 +560,8 @@ class CrudListView(PermissionRequiredContainerCrudMixin, ListView): fm = model._meta.get_field(fo) except Exception as e: username = self.request.user.username - self.logger.error("user=" + username + ". " + str(e)) + self.logger.error( + "user=" + username + ". " + str(e)) pass if fm and hasattr(fm, 'related_model')\ @@ -824,7 +827,7 @@ class CrudUpdateView(PermissionRequiredContainerCrudMixin, logger = logging.getLogger(__name__) def form_valid(self, form): - + self.object = form.instance try: self.object.modifier = self.request.user @@ -882,12 +885,12 @@ class CrudDeleteView(PermissionRequiredContainerCrudMixin, error_msg2 += '{} - {}, '.format( i._meta.verbose_name, i ) - error_msg2 = error_msg2[:len(error_msg2)-2] + '.' + error_msg2 = error_msg2[:len(error_msg2) - 2] + '.' error_msg += '' - + username = request.user.username self.logger.error("user=" + username + ". Registro não pode ser removido, pois " - "é referenciado por outros registros: " + error_msg2) + "é referenciado por outros registros: " + error_msg2) messages.add_message(request, messages.ERROR, error_msg) diff --git a/setup.py b/setup.py index a64217d42..e44ded347 100644 --- a/setup.py +++ b/setup.py @@ -10,15 +10,14 @@ os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) install_requires = [ 'django>=1.11,<2.0', - 'django-haystack==2.8.1', 'django-bootstrap3==11.0.0', + 'django-haystack==2.8.1', 'django-filter==2.0.0', 'djangorestframework==3.9.0', - - 'dj-database-url==0.4.1', + 'dj-database-url==0.5.0', 'django-bower==5.2.0', 'django-braces==1.9.0', - 'django-compressor==2.0', + 'django-crispy-forms==1.6.1', 'django-extensions==1.9.8', 'django-extra-views==0.11.0', @@ -47,6 +46,8 @@ install_requires = [ # 'git+git://github.com/interlegis/trml2pdf.git', # 'git+git://github.com/jasperlittle/django-rest-framework-docs' # 'git+git://github.com/rubgombar1/django-admin-bootstrapped.git'' + + #'django-compressor==2.2', ] setup( name='interlegis-sapl',