From ce5c260f4ce46f08705d3c0c3662506fb50f5653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Arranz?= Date: Wed, 21 Jun 2017 14:08:12 +0200 Subject: [PATCH] Pass Context instances to Template.render. See #289 --- src/wirecloud/platform/widget/utils.py | 6 +++--- src/wirecloud/platform/wiring/utils.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/wirecloud/platform/widget/utils.py b/src/wirecloud/platform/widget/utils.py index e645de7b5c..f3d5afe255 100644 --- a/src/wirecloud/platform/widget/utils.py +++ b/src/wirecloud/platform/widget/utils.py @@ -24,7 +24,7 @@ from django.core.cache import cache from django.conf import settings from django.db.models import Q -from django.template import Template +from django.template import Context, Template from lxml import etree from wirecloud.catalogue.models import CatalogueResource @@ -126,7 +126,7 @@ def get_widget_platform_style(theme): code += '{% endcompress %}' - result = Template(code).render({}) + result = Template(code).render(Context()) doc = etree.parse(BytesIO(('' + result + '').encode('utf-8')), etree.XMLParser()) files = [link.get('href') for link in doc.getroot()] @@ -150,7 +150,7 @@ def get_widget_api_files(request): {% endcompress %}''' - result = Template(code).render({}) + result = Template(code).render(Context()) doc = etree.parse(BytesIO(('' + result + '').encode('utf-8')), etree.XMLParser()) files = [script.get('src') for script in doc.getroot()] diff --git a/src/wirecloud/platform/wiring/utils.py b/src/wirecloud/platform/wiring/utils.py index eab65e15e6..73370aef2f 100644 --- a/src/wirecloud/platform/wiring/utils.py +++ b/src/wirecloud/platform/wiring/utils.py @@ -22,7 +22,7 @@ from io import BytesIO from django.conf import settings -from django.template import loader, Template +from django.template import Context, loader, Template from lxml import etree from wirecloud.commons.utils.http import get_absolute_static_url, get_current_domain @@ -83,7 +83,7 @@ def get_operator_api_files(request): {% endcompress %}''' - result = Template(code).render({}) + result = Template(code).render(Context()) doc = etree.parse(BytesIO(('' + result + '').encode('utf-8')), etree.XMLParser()) files = [script.get('src') for script in doc.getroot()]