diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 38992efd4..5f1a03cc6 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -21,7 +21,6 @@ python-decouple==3.1 psycopg2-binary==2.7.6.1 pyyaml==5.3.1 pytz==2019.3 -rtyaml==1.0.0 python-magic==0.4.15 unipath==1.1 WeasyPrint==51 diff --git a/sapl/crispy_layout_mixin.py b/sapl/crispy_layout_mixin.py index 2f212740a..9c23c8154 100644 --- a/sapl/crispy_layout_mixin.py +++ b/sapl/crispy_layout_mixin.py @@ -7,7 +7,7 @@ from django import template from django.urls import reverse, reverse_lazy from django.utils import formats from django.utils.translation import ugettext as _ -import rtyaml +import yaml def heads_and_tails(list_of_lists): @@ -332,17 +332,12 @@ class CrispyLayoutFormMixin: def read_yaml_from_file(yaml_layout): from django.utils.safestring import SafeText - # TODO cache this at application level t = template.loader.get_template(yaml_layout) - # aqui é importante converter para str pois, dependendo do ambiente, - # o rtyaml pode usar yaml.CSafeLoader, que exige str ou stream - rendered = str(t.render()) - # Força conversão para string caso seja SafeText. if isinstance(rendered, SafeText): rendered = rendered.strip() - return rtyaml.load(rendered) + return yaml.load(rendered) def read_layout_from_yaml(yaml_layout, key): diff --git a/sapl/test_crispy_layout_mixin.py b/sapl/test_crispy_layout_mixin.py index 2c72a1b44..7ffca2306 100644 --- a/sapl/test_crispy_layout_mixin.py +++ b/sapl/test_crispy_layout_mixin.py @@ -1,6 +1,6 @@ from unittest import mock -import rtyaml +import yaml from sapl.crispy_layout_mixin import read_layout_from_yaml @@ -18,7 +18,7 @@ ModelName: - highlander ''' with mock.patch('sapl.crispy_layout_mixin.read_yaml_from_file') as ryff: - ryff.return_value = rtyaml.load(stub_content) + ryff.return_value = yaml.load(stub_content) assert read_layout_from_yaml('....', 'ModelName') == [ ['Cool Legend', [('name', 9), ('place', 2), ('tiny', 1)], diff --git a/setup.py b/setup.py index 3e2287152..e7b108483 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,6 @@ install_requires = [ 'psycopg2-binary==2.7.6.1', 'pyyaml==4.2b1', 'pytz==2018.9', - 'rtyaml==0.0.5', 'python-magic==0.4.15', 'unipath==1.1', 'WeasyPrint==44',