From: Thomas Goirand Date: Thu, 21 Jul 2016 11:54:23 +0000 (+0000) Subject: Add django-1.10-do-not-use-django.template.Context-function.patch X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=cc5107ca439ec89671d14a32f23279dc4dd1242c;p=openstack-build%2Fhorizon-build.git Add django-1.10-do-not-use-django.template.Context-function.patch Rewritten-From: 79c842609beea970c26452dc7d78ae91e2b6646b --- diff --git a/xenial/debian/changelog b/xenial/debian/changelog index cbe79c9..e1126ec 100644 --- a/xenial/debian/changelog +++ b/xenial/debian/changelog @@ -6,6 +6,7 @@ horizon (3:10.0.0~b2-2) UNRELEASED; urgency=medium - django-1.10-fixes-get-form-uses-kwargs.patch - django-1.10-horizon.test.settings.patch - django-1.10-openstack_dashboard.test.settings.patch + - django-1.10-do-not-use-django.template.Context-function.patch -- Thomas Goirand Wed, 20 Jul 2016 10:49:45 +0200 diff --git a/xenial/debian/patches/django-1.10-do-not-use-django.template.Context-function.patch b/xenial/debian/patches/django-1.10-do-not-use-django.template.Context-function.patch new file mode 100644 index 0000000..e291dc2 --- /dev/null +++ b/xenial/debian/patches/django-1.10-do-not-use-django.template.Context-function.patch @@ -0,0 +1,84 @@ +Description: [Django 1.10] Do not use django.template.Context() + See: + https://docs.djangoproject.com/en/1.10/ref/templates/upgrading/ + section: + get_template() and select_template() +Author: Thomas Goirand +Forwarded: no +Last-Update: 2016-07-21 + +--- horizon-10.0.0~b2.orig/horizon/forms/fields.py ++++ horizon-10.0.0~b2/horizon/forms/fields.py +@@ -24,7 +24,6 @@ from django.core import urlresolvers + from django.forms import fields + from django.forms.utils import flatatt # noqa + from django.forms import widgets +-from django.template import Context # noqa + from django.template.loader import get_template # noqa + from django.utils.encoding import force_text + from django.utils.functional import Promise # noqa +@@ -261,14 +260,14 @@ class ThemableSelectWidget(SelectWidget) + id = attrs.pop('id', 'id_%s' % name) + + template = get_template('horizon/common/fields/_themable_select.html') +- context = Context({ ++ context = { + 'name': name, + 'options': new_choices, + 'id': id, + 'value': value, + 'initial_value': initial_value, + 'select_attrs': attrs, +- }) ++ } + return template.render(context) + + +--- horizon-10.0.0~b2.orig/horizon/test/tests/templatetags.py ++++ horizon-10.0.0~b2/horizon/test/tests/templatetags.py +@@ -19,7 +19,6 @@ + import re + + from django.conf import settings +-from django.template import Context # noqa + from django.template import Template # noqa + from django.utils.text import normalize_newlines # noqa + +@@ -48,7 +47,7 @@ class TemplateTagTests(test.TestCase): + context = context or {} + template = Template("{%% load %s %%} %s" + % (tag_require, template_text)) +- return template.render(Context(context)) ++ return template.render(context) + + def test_site_branding_tag(self): + """Test if site_branding tag renders the correct setting.""" +--- horizon-10.0.0~b2.orig/openstack_dashboard/management/commands/make_web_conf.py ++++ horizon-10.0.0~b2/openstack_dashboard/management/commands/make_web_conf.py +@@ -23,7 +23,7 @@ import warnings + + from django.conf import settings + from django.core.management.base import BaseCommand # noqa +-from django.template import Context, Template # noqa ++from django.template import Template # noqa + + # Suppress DeprecationWarnings which clutter the output to the point of + # rendering it unreadable. +@@ -66,7 +66,7 @@ def _getattr(obj, name, default): + return default + + +-context = Context({ ++context = { + 'DJANGO_SETTINGS_MODULE': os.environ['DJANGO_SETTINGS_MODULE'], + 'HOSTNAME': socket.getfqdn(), + 'PROJECT_PATH': os.path.realpath( +@@ -76,7 +76,7 @@ context = Context({ + 'SSLCERT': '/etc/pki/tls/certs/ca.crt', + 'SSLKEY': '/etc/pki/tls/private/ca.key', + 'CACERT': None, +-}) ++} + + context['PROJECT_ROOT'] = os.path.dirname(context['PROJECT_PATH']) + context['PROJECT_DIR_NAME'] = os.path.basename( diff --git a/xenial/debian/patches/series b/xenial/debian/patches/series index acb9982..d1fcceb 100644 --- a/xenial/debian/patches/series +++ b/xenial/debian/patches/series @@ -7,3 +7,4 @@ django-1.10-fix-wrong-django.conf.urls.url-call.patch django-1.10-fixes-get-form-uses-kwargs.patch django-1.10-openstack_dashboard.test.settings.patch django-1.10-horizon.test.settings.patch +django-1.10-do-not-use-django.template.Context-function.patch