From ad64a212ba27c45d0dadcb901bc012879882166a Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Mon, 19 Jan 2015 10:11:21 +0100 Subject: [PATCH] Unify the syntax used for the {{ ... }} delimter in Jinja2 templates According to the Jinja2 documentation the preferred usage for the syntax of the {{ ... }} delimter is {{ ... }}. This patch changes all occurcens of {{... and ...}} to {{ ... }}. Change-Id: I755475d1476cbfeac190217fa67dc2640917762c --- doc/source/topics/settings.rst | 2 +- horizon/conf/panel_template/tests.py.tmpl | 2 +- .../common/_modal_form_add_members.html | 2 +- .../common/_modal_form_update_metadata.html | 4 ++-- .../templates/horizon/common/_tab_group.html | 2 +- horizon/test/helpers.py | 4 ++-- horizon/test/tests/templatetags.py | 8 +++---- horizon/test/tests/utils.py | 22 +++++++++---------- .../admin/info/templates/info/index.html | 2 +- .../metadata_defs/resource_types.html | 2 +- .../volumes/volume_types/qos_specs/edit.html | 4 ++-- .../keypairs/download.html | 2 +- .../templates/instances/_detail_overview.html | 2 +- .../instances/_flavors_and_quotas.html | 4 ++-- .../loadbalancers/_member_details.html | 2 +- .../loadbalancers/_monitor_details.html | 2 +- .../loadbalancers/_pool_details.html | 8 +++---- .../templates/loadbalancers/_vip_details.html | 6 ++--- .../templates/volumes/volumes/_limits.html | 2 +- .../volumes/volumes/_snapshot_limits.html | 2 +- .../vpn/_ipsecsiteconnection_details.html | 6 ++--- .../templates/vpn/_vpnservice_details.html | 4 ++-- 22 files changed, 47 insertions(+), 47 deletions(-) diff --git a/doc/source/topics/settings.rst b/doc/source/topics/settings.rst index a61f6aa1f1..93b73d7f5a 100755 --- a/doc/source/topics/settings.rst +++ b/doc/source/topics/settings.rst @@ -301,7 +301,7 @@ to be shown per page if API pagination support for this exists. Default: ``None`` A tuple of tuples which define multiple regions. The tuple format is -``('http://{{keystone_host}}:5000/v2.0', '{{region_name}}')``. If any regions +``('http://{{ keystone_host }}:5000/v2.0', '{{ region_name }}')``. If any regions are specified the login form will have a dropdown selector for authenticating to the appropriate region, and there will be a region switcher dropdown in the site header when logged in. diff --git a/horizon/conf/panel_template/tests.py.tmpl b/horizon/conf/panel_template/tests.py.tmpl index e8bba98c61..4663b3b349 100644 --- a/horizon/conf/panel_template/tests.py.tmpl +++ b/horizon/conf/panel_template/tests.py.tmpl @@ -1,7 +1,7 @@ from horizon.test import helpers as test -class {{ panel_name|title}}Tests(test.TestCase): +class {{ panel_name|title }}Tests(test.TestCase): # Unit tests for {{ panel_name }}. def test_me(self): self.assertTrue(1 + 1 == 2) diff --git a/horizon/templates/horizon/common/_modal_form_add_members.html b/horizon/templates/horizon/common/_modal_form_add_members.html index eaedd55a97..89cbf8169f 100644 --- a/horizon/templates/horizon/common/_modal_form_add_members.html +++ b/horizon/templates/horizon/common/_modal_form_add_members.html @@ -2,7 +2,7 @@ {% load i18n %} {% block modal-body %} - + {% endblock %} {% block modal-js %} diff --git a/horizon/templates/horizon/common/_modal_form_update_metadata.html b/horizon/templates/horizon/common/_modal_form_update_metadata.html index 11fd0ccc49..348279baea 100644 --- a/horizon/templates/horizon/common/_modal_form_update_metadata.html +++ b/horizon/templates/horizon/common/_modal_form_update_metadata.html @@ -221,8 +221,8 @@ {% endblock %} diff --git a/horizon/templates/horizon/common/_tab_group.html b/horizon/templates/horizon/common/_tab_group.html index 89ca70ca79..a58238c236 100644 --- a/horizon/templates/horizon/common/_tab_group.html +++ b/horizon/templates/horizon/common/_tab_group.html @@ -5,7 +5,7 @@ diff --git a/horizon/test/helpers.py b/horizon/test/helpers.py index 3c5b21d13a..f20c9172da 100644 --- a/horizon/test/helpers.py +++ b/horizon/test/helpers.py @@ -236,12 +236,12 @@ class JasmineTests(SeleniumTestCase): .. attribute:: sources - A list of JS source files (the {{STATIC_URL}} will be added + A list of JS source files (the {{ STATIC_URL }} will be added automatically, these are the source files tested .. attribute:: specs - A list of Jasmine JS spec files (the {{STATIC_URL}} will be added + A list of Jasmine JS spec files (the {{ STATIC_URL }} will be added automatically .. attribute:: template_name diff --git a/horizon/test/tests/templatetags.py b/horizon/test/tests/templatetags.py index 580eaa1ee4..4cf74a050e 100644 --- a/horizon/test/tests/templatetags.py +++ b/horizon/test/tests/templatetags.py @@ -87,8 +87,8 @@ class TemplateTagTests(test.TestCase): 'val2': 'hellotrunc', 'val3': 'four'} - text = ('{{test.val1|truncate:1}}#{{test.val2|truncate:4}}#' - '{{test.val3|truncate:10}}') + text = ('{{ test.val1|truncate:1 }}#{{ test.val2|truncate:4 }}#' + '{{ test.val3|truncate:10 }}') expected = u' h#h...#four' rendered_str = self.render_template(tag_require='truncate_filter', @@ -101,8 +101,8 @@ class TemplateTagTests(test.TestCase): 'val2': 1000, 'val3': float('inf')} - text = ('{{test.val1|quota:"TB"}}#{{test.val2|quota}}#' - '{{test.val3|quota}}') + text = ('{{ test.val1|quota:"TB" }}#{{ test.val2|quota }}#' + '{{ test.val3|quota }}') expected = u' 100 TB Available#1000 Available#No Limit' diff --git a/horizon/test/tests/utils.py b/horizon/test/tests/utils.py index 7d3fa1561b..d8a3f01cd4 100644 --- a/horizon/test/tests/utils.py +++ b/horizon/test/tests/utils.py @@ -260,25 +260,25 @@ class FiltersTests(test.TestCase): def test_parse_isotime_filter(self): c = django.template.Context({'time': ''}) - t = django.template.Template('{{time|parse_isotime}}') + t = django.template.Template('{{ time|parse_isotime }}') output = u"" self.assertEqual(output, t.render(c)) c = django.template.Context({'time': 'error'}) - t = django.template.Template('{{time|parse_isotime}}') + t = django.template.Template('{{ time|parse_isotime }}') output = u"" self.assertEqual(output, t.render(c)) c = django.template.Context({'time': 'error'}) - t = django.template.Template('{{time|parse_isotime:"test"}}') + t = django.template.Template('{{ time|parse_isotime:"test" }}') output = u"test" self.assertEqual(output, t.render(c)) c = django.template.Context({'time': '2007-03-04T21:08:12'}) - t = django.template.Template('{{time|parse_isotime:"test"}}') + t = django.template.Template('{{ time|parse_isotime:"test" }}') output = u"March 4, 2007, 3:08 p.m." self.assertEqual(output, t.render(c)) @@ -294,41 +294,41 @@ class TimeSinceNeverFilterTests(test.TestCase): def test_timesince_or_never_returns_default_for_empty_string(self): c = django.template.Context({'time': ''}) - t = django.template.Template('{{time|timesince_or_never}}') + t = django.template.Template('{{ time|timesince_or_never }}') self.assertEqual(self.default, t.render(c)) def test_timesince_or_never_returns_default_for_none(self): c = django.template.Context({'time': None}) - t = django.template.Template('{{time|timesince_or_never}}') + t = django.template.Template('{{ time|timesince_or_never }}') self.assertEqual(self.default, t.render(c)) def test_timesince_or_never_returns_default_for_gibberish(self): c = django.template.Context({'time': django.template.Context()}) - t = django.template.Template('{{time|timesince_or_never}}') + t = django.template.Template('{{ time|timesince_or_never }}') self.assertEqual(self.default, t.render(c)) def test_timesince_or_never_returns_with_custom_default(self): custom = "Hello world" c = django.template.Context({'date': ''}) - t = django.template.Template('{{date|timesince_or_never:"%s"}}' + t = django.template.Template('{{ date|timesince_or_never:"%s" }}' % custom) self.assertEqual(custom, t.render(c)) def test_timesince_or_never_returns_with_custom_empty_string_default(self): c = django.template.Context({'date': ''}) - t = django.template.Template('{{date|timesince_or_never:""}}') + t = django.template.Template('{{ date|timesince_or_never:"" }}') self.assertEqual("", t.render(c)) def test_timesince_or_never_returns_same_output_as_django_date(self): d = datetime.date(year=2014, month=3, day=7) c = django.template.Context({'date': d}) - t = django.template.Template('{{date|timesince_or_never}}') + t = django.template.Template('{{ date|timesince_or_never }}') self.assertEqual(defaultfilters.timesince(d), t.render(c)) def test_timesince_or_never_returns_same_output_as_django_datetime(self): now = datetime.datetime.now() c = django.template.Context({'date': now}) - t = django.template.Template('{{date|timesince_or_never}}') + t = django.template.Template('{{ date|timesince_or_never }}') self.assertEqual(defaultfilters.timesince(now), t.render(c)) diff --git a/openstack_dashboard/dashboards/admin/info/templates/info/index.html b/openstack_dashboard/dashboards/admin/info/templates/info/index.html index da8135183a..bfe5578a11 100644 --- a/openstack_dashboard/dashboards/admin/info/templates/info/index.html +++ b/openstack_dashboard/dashboards/admin/info/templates/info/index.html @@ -11,7 +11,7 @@
{{ tab_group.render }}
- {% blocktrans with version_info=version %}Version: {{version_info}} + {% blocktrans with version_info=version %}Version: {{ version_info }} {% endblocktrans %}
diff --git a/openstack_dashboard/dashboards/admin/metadata_defs/templates/metadata_defs/resource_types.html b/openstack_dashboard/dashboards/admin/metadata_defs/templates/metadata_defs/resource_types.html index 5033449f67..285dd1809c 100644 --- a/openstack_dashboard/dashboards/admin/metadata_defs/templates/metadata_defs/resource_types.html +++ b/openstack_dashboard/dashboards/admin/metadata_defs/templates/metadata_defs/resource_types.html @@ -68,7 +68,7 @@ {% endblock %} diff --git a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/qos_specs/edit.html b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/qos_specs/edit.html index c321c13dcb..141e659576 100644 --- a/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/qos_specs/edit.html +++ b/openstack_dashboard/dashboards/admin/volumes/templates/volumes/volume_types/qos_specs/edit.html @@ -4,9 +4,9 @@ {% block title %}{% trans "Edit Spec" %}{% endblock %} {% block page_header %} -

{% trans "QoS Spec: " %} {{qos_spec_name}}

+

{% trans "QoS Spec: " %} {{ qos_spec_name }}

{% endblock page_header %} {% block main %} {% include "admin/volumes/volume_types/qos_specs/_edit.html" %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/openstack_dashboard/dashboards/project/access_and_security/templates/access_and_security/keypairs/download.html b/openstack_dashboard/dashboards/project/access_and_security/templates/access_and_security/keypairs/download.html index 9ac8508b9e..769cdfc80e 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/templates/access_and_security/keypairs/download.html +++ b/openstack_dashboard/dashboards/project/access_and_security/templates/access_and_security/keypairs/download.html @@ -13,7 +13,7 @@