]> review.fuel-infra Code Review - openstack-build/horizon-build.git/commitdiff
Add django-1.10-do-not-use-django.template.Context-function.patch
authorThomas Goirand <thomas@goirand.fr>
Thu, 21 Jul 2016 11:54:23 +0000 (11:54 +0000)
committerThomas Goirand <thomas@goirand.fr>
Thu, 21 Jul 2016 11:54:23 +0000 (11:54 +0000)
Rewritten-From: 79c842609beea970c26452dc7d78ae91e2b6646b

xenial/debian/changelog
xenial/debian/patches/django-1.10-do-not-use-django.template.Context-function.patch [new file with mode: 0644]
xenial/debian/patches/series

index cbe79c91b887e4a557a0970562379e0868398ae7..e1126ec20a4e5ec98f90e983214b1ff50fdc3262 100644 (file)
@@ -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 <zigo@debian.org>  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 (file)
index 0000000..e291dc2
--- /dev/null
@@ -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 <zigo@debian.org>
+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(
index acb99825cd4917cbd7d6c0c42c2bb209a154530f..d1fcceb472caedcd61698e002cbc15c7e8eb9c97 100644 (file)
@@ -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