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
This commit is contained in:
Christian Berendt 2015-01-19 10:11:21 +01:00
parent 27ccf91997
commit ad64a212ba
22 changed files with 47 additions and 47 deletions

View File

@ -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.

View File

@ -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)

View File

@ -2,7 +2,7 @@
{% load i18n %}
{% block modal-body %}
<input type="hidden" id="hidden_redirect_back_to_home" name="redirect" value="{{redirect}}"/>
<input type="hidden" id="hidden_redirect_back_to_home" name="redirect" value="{{ redirect }}"/>
{% endblock %}
{% block modal-js %}

View File

@ -221,8 +221,8 @@
</div>
</div>
<script type="text/javascript">
var existing_metadata = {{existing_metadata|safe}};
var available_metadata = {{available_metadata|safe}};
var existing_metadata = {{ existing_metadata|safe }};
var available_metadata = {{ available_metadata|safe }};
</script>
{% endblock %}

View File

@ -5,7 +5,7 @@
<ul id="{{ tab_group.get_id }}" {{ tab_group.attr_string|safe }}>
{% for tab in tabs %}
<li {{ tab.attr_string|safe }}>
<a href="?{{ tab_group.param_name}}={{ tab.get_id }}" data-toggle="tab" data-target="#{{ tab.get_id }}" data-loaded='{{ tab.load|yesno:"true,false" }}'>{{ tab.name }}</a>
<a href="?{{ tab_group.param_name }}={{ tab.get_id }}" data-toggle="tab" data-target="#{{ tab.get_id }}" data-loaded='{{ tab.load|yesno:"true,false" }}'>{{ tab.name }}</a>
</li>
{% endfor %}
</ul>

View File

@ -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

View File

@ -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'

View File

@ -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))

View File

@ -11,7 +11,7 @@
<div class="col-sm-12">
{{ tab_group.render }}
<div class="version_label">
{% blocktrans with version_info=version %}Version: {{version_info}}
{% blocktrans with version_info=version %}Version: {{ version_info }}
{% endblocktrans %}
</div>
</div>

View File

@ -68,7 +68,7 @@
</div>
<script type="text/javascript">
var resource_types = {{resource_types|safe}};
var resource_types = {{ resource_types|safe }};
</script>
{% endblock %}

View File

@ -4,9 +4,9 @@
{% block title %}{% trans "Edit Spec" %}{% endblock %}
{% block page_header %}
<h2>{% trans "QoS Spec: " %} {{qos_spec_name}} </h2>
<h2>{% trans "QoS Spec: " %} {{ qos_spec_name }} </h2>
{% endblock page_header %}
{% block main %}
{% include "admin/volumes/volume_types/qos_specs/_edit.html" %}
{% endblock %}
{% endblock %}

View File

@ -13,7 +13,7 @@
</div>
<div class="modal-body clearfix">
<a href="{% url 'horizon:project:access_and_security:keypairs:generate' keypair_name "regenerate" %}">
{% blocktrans %}Download key pair &quot;{{ keypair_name}}&quot;{% endblocktrans %}
{% blocktrans %}Download key pair &quot;{{ keypair_name }}&quot;{% endblocktrans %}
</a>
</div>
<script type="text/javascript" charset="utf-8">

View File

@ -72,7 +72,7 @@
<dt>{{ network|title }}</dt>
<dd>
{% for ip in ip_list %}
{% if not forloop.last %}{{ ip.addr}},&nbsp;{% else %}{{ip.addr}}{% endif %}
{% if not forloop.last %}{{ ip.addr }},&nbsp;{% else %}{{ ip.addr }}{% endif %}
{% endfor %}
</dd>
{% endfor %}

View File

@ -40,8 +40,8 @@
</div>
<script type="text/javascript" charset="utf-8">
some_disabled_msg = '{{_("Some flavors not meeting minimum image requirements have been disabled.")|escapejs}}';
all_disabled_msg = '{{_("No flavors meet minimum criteria for selected image.")|escapejs}}';
some_disabled_msg = '{{_("Some flavors not meeting minimum image requirements have been disabled.")|escapejs }}';
all_disabled_msg = '{{_("No flavors meet minimum criteria for selected image.")|escapejs }}';
if(typeof horizon.Quota !== 'undefined') {
horizon.Quota.initWithFlavors({{ flavors|safe|default:"{}" }});

View File

@ -11,7 +11,7 @@
<dt>{% trans "Pool" %}</dt>
{% url 'horizon:project:loadbalancers:pooldetails' member.pool_id as pool_url %}
<dd><a href="{{pool_url}}">{{ member.pool.name_or_id }}</a></dd>
<dd><a href="{{ pool_url }}">{{ member.pool.name_or_id }}</a></dd>
<dt>{% trans "Address" %}</dt>
<dd>{{ member.address }}</dd>

View File

@ -39,7 +39,7 @@
{% if monitor.pools %}
{% for pool in monitor.pools %}
{% url 'horizon:project:loadbalancers:pooldetails' pool.id as pool_url %}
<dd><a href="{{pool_url}}">{{ pool.name_or_id }}</a></dd>
<dd><a href="{{ pool_url }}">{{ pool.name_or_id }}</a></dd>
{% endfor %}
{% else %}
<dd>{% trans "None" %}</dd>

View File

@ -18,7 +18,7 @@
<dt>{% trans "VIP" %}</dt>
{% if pool.vip_id %}
{% url 'horizon:project:loadbalancers:vipdetails' pool.vip_id as vip_url %}
<dd><a href="{{vip_url}}">{{ pool.vip.name_or_id }}</a></dd>
<dd><a href="{{ vip_url }}">{{ pool.vip.name_or_id }}</a></dd>
{% else %}
<dd>{% trans "-" %}</dd>
{% endif %}
@ -28,7 +28,7 @@
<dt>{% trans "Subnet" %}</dt>
{% url 'horizon:project:networks:subnets:detail' pool.subnet_id as subnet_url %}
<dd><a href="{{subnet_url}}">{{ pool.subnet.name_or_id }} {{pool.subnet.cidr}}</a></dd>
<dd><a href="{{ subnet_url }}">{{ pool.subnet.name_or_id }} {{ pool.subnet.cidr }}</a></dd>
<dt>{% trans "Protocol" %}</dt>
<dd>{{ pool.protocol }}</dd>
@ -41,7 +41,7 @@
{% if pool.members %}
{% for member in pool.members %}
{% url 'horizon:project:loadbalancers:memberdetails' member.id as member_url %}
<a href="{{member_url}}">{{member.address}}:{{member.protocol_port}}</a><br>
<a href="{{ member_url }}">{{ member.address }}:{{ member.protocol_port }}</a><br>
{% endfor %}
{% else %}
<dd>{% trans "-" %}</dd>
@ -53,7 +53,7 @@
{% if pool.health_monitors %}
{% for monitor in pool.health_monitors %}
{% url 'horizon:project:loadbalancers:monitordetails' monitor.id as monitor_url %}
<a href="{{monitor_url}}">{{ monitor.display_name }}</a><br>
<a href="{{ monitor_url }}">{{ monitor.display_name }}</a><br>
{% endfor %}
{% else %}
<dd>{% trans "-" %}</dd>

View File

@ -17,7 +17,7 @@
<dt>{% trans "Subnet" %}</dt>
{% url 'horizon:project:networks:subnets:detail' vip.subnet_id as subnet_url %}
<dd><a href="{{subnet_url}}">{{ vip.subnet.name_or_id }} {{ vip.subnet.cidr }}</a></dd>
<dd><a href="{{ subnet_url }}">{{ vip.subnet.name_or_id }} {{ vip.subnet.cidr }}</a></dd>
<dt>{% trans "Address" %}</dt>
<dd>{{ vip.address }}</dd>
@ -30,11 +30,11 @@
<dt>{% trans "Pool" %}</dt>
{% url 'horizon:project:loadbalancers:pooldetails' vip.pool_id as pool_url %}
<dd><a href="{{pool_url}}">{{ vip.pool.name_or_id }}</a></dd>
<dd><a href="{{ pool_url }}">{{ vip.pool.name_or_id }}</a></dd>
<dt>{% trans "Port ID" %}</dt>
{% url 'horizon:project:networks:ports:detail' vip.port_id as port_url %}
<dd><a href="{{port_url}}">{{ vip.port_id }}</a></dd>
<dd><a href="{{ port_url }}">{{ vip.port_id }}</a></dd>
<dt>{% trans "Session Persistence" %}</dt>
{% if vip.session_persistence %}

View File

@ -19,7 +19,7 @@
<p>{% block total %}{{ usages.maxTotalVolumes|quota|intcomma }}{% endblock %}</p>
</div>
<div id={% block type_id %}"quota_volumes"{% endblock %} data-progress-indicator-step-by="1" data-quota-limit={% block total_progress %}"{{ usages.maxTotalVolumes}}"{% endblock %} data-quota-used={% block used_progress %}"{{ usages.volumesUsed }}"{% endblock %} class="quota_bar">
<div id={% block type_id %}"quota_volumes"{% endblock %} data-progress-indicator-step-by="1" data-quota-limit={% block total_progress %}"{{ usages.maxTotalVolumes }}"{% endblock %} data-quota-used={% block used_progress %}"{{ usages.volumesUsed }}"{% endblock %} class="quota_bar">
</div>

View File

@ -34,7 +34,7 @@
{% endblock %}
{% block total_progress %}
"{{ usages.maxTotalSnapshots}}"
"{{ usages.maxTotalSnapshots }}"
{% endblock %}
{% block used_progress %}

View File

@ -18,15 +18,15 @@
<dt>{% trans "VPN Service" %}</dt>
{% url 'horizon:project:vpn:vpnservicedetails' ipsecsiteconnection.vpnservice_id as vpnservice_url %}
<dd><a href="{{ vpnservice_url}}">{{ ipsecsiteconnection.vpnservice.name_or_id }}</a></dd>
<dd><a href="{{ vpnservice_url }}">{{ ipsecsiteconnection.vpnservice.name_or_id }}</a></dd>
<dt>{% trans "IKE Policy" %}</dt>
{% url 'horizon:project:vpn:ikepolicydetails' ipsecsiteconnection.ikepolicy_id as ikepolicy_url %}
<dd><a href="{{ ikepolicy_url}}">{{ ipsecsiteconnection.ikepolicy.name_or_id }}</a></dd>
<dd><a href="{{ ikepolicy_url }}">{{ ipsecsiteconnection.ikepolicy.name_or_id }}</a></dd>
<dt>{% trans "IPSec Policy" %}</dt>
{% url 'horizon:project:vpn:ipsecpolicydetails' ipsecsiteconnection.ipsecpolicy_id as ipsecpolicy_url %}
<dd><a href="{{ ipsecpolicy_url}}">{{ ipsecsiteconnection.ipsecpolicy.name_or_id }}</a></dd>
<dd><a href="{{ ipsecpolicy_url }}">{{ ipsecsiteconnection.ipsecpolicy.name_or_id }}</a></dd>
<dt>{% trans "Peer gateway public IPv4/IPv6 Address or FQDN" %}</dt>
<dd>{{ ipsecsiteconnection.peer_address }}</dd>

View File

@ -18,11 +18,11 @@
<dt>{% trans "Router ID" %}</dt>
{% url 'horizon:project:routers:detail' vpnservice.router_id as router_url %}
<dd><a href="{{ router_url}}">{{ vpnservice.router.name_or_id }}</a></dd>
<dd><a href="{{ router_url }}">{{ vpnservice.router.name_or_id }}</a></dd>
<dt>{% trans "Subnet ID" %}</dt>
{% url 'horizon:project:networks:subnets:detail' vpnservice.subnet_id as subnet_url %}
<dd><a href="{{ subnet_url}}">{{ vpnservice.subnet.name_or_id}} {{vpnservice.subnet.cidr}}</a></dd>
<dd><a href="{{ subnet_url }}">{{ vpnservice.subnet.name_or_id }} {{ vpnservice.subnet.cidr }}</a></dd>
<dt>{% trans "VPN Connections" %}</dt>
<dd>