[llvm-commits] [zorg] r151319 - in /zorg/trunk/lnt/lnt/server/ui: app.py templates/layout.html templates/v4_graph.html templates/v4_run.html templates/v4_utils.html
Daniel Dunbar
daniel at zuster.org
Thu Feb 23 16:57:49 PST 2012
Author: ddunbar
Date: Thu Feb 23 18:57:49 2012
New Revision: 151319
URL: http://llvm.org/viewvc/llvm-project?rev=151319&view=rev
Log:
[lnt] lnt.server.ui: Run Jinja2 in StrictUndefined mode, and fix up assorted template issues.
Modified:
zorg/trunk/lnt/lnt/server/ui/app.py
zorg/trunk/lnt/lnt/server/ui/templates/layout.html
zorg/trunk/lnt/lnt/server/ui/templates/v4_graph.html
zorg/trunk/lnt/lnt/server/ui/templates/v4_run.html
zorg/trunk/lnt/lnt/server/ui/templates/v4_utils.html
Modified: zorg/trunk/lnt/lnt/server/ui/app.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/app.py?rev=151319&r1=151318&r2=151319&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/app.py (original)
+++ zorg/trunk/lnt/lnt/server/ui/app.py Thu Feb 23 18:57:49 2012
@@ -1,3 +1,4 @@
+import jinja2
import logging
import logging.handlers
import os
@@ -81,6 +82,9 @@
# Register additional filters.
lnt.server.ui.filters.register(app)
+ # Set up strict undefined mode for templates.
+ app.jinja_env.undefined = jinja2.StrictUndefined
+
# Load the application configuration.
app.load_config(config_path)
Modified: zorg/trunk/lnt/lnt/server/ui/templates/layout.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/layout.html?rev=151319&r1=151318&r2=151319&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/layout.html (original)
+++ zorg/trunk/lnt/lnt/server/ui/templates/layout.html Thu Feb 23 18:57:49 2012
@@ -15,7 +15,7 @@
{% block javascript %}{% endblock %}
</script>
</head>
-{% if self.onload %}
+{% if self.onload is defined %}
<body onload="{{ self.onload() }}">
{% else %}
<body>
@@ -38,7 +38,7 @@
<strong>Database:</strong>
<select name="db" onchange="submit()">
{% for name in old_config.databases.keys()|sort %}
- <option{{" selected" if name == g.db_name}}>{{ name }}</option>
+ <option{{" selected" if name == g.db_name else ""}}>{{ name }}</option>
{% endfor %}
</select>
<input type="submit" value="Go"/>
@@ -61,7 +61,7 @@
</div>
{# Include any database log, if present. #}
-{% if g.db_log %}
+{% if g.db_log is defined %}
<hr>
<h3>SQL Log</h3>
Modified: zorg/trunk/lnt/lnt/server/ui/templates/v4_graph.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/v4_graph.html?rev=151319&r1=151318&r2=151319&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/v4_graph.html (original)
+++ zorg/trunk/lnt/lnt/server/ui/templates/v4_graph.html Thu Feb 23 18:57:49 2012
@@ -43,31 +43,31 @@
<form action="" method="get">
<b>Show Median Absolute Deviation:</b>
<input type="checkbox" name="show_mad" value="yes" {{
- 'checked' if options.show_mad}}><br>
+ 'checked' if options.show_mad else ""}}><br>
<b>Show Standard Deviation:</b>
<input type="checkbox" name="show_stddev" value="yes" {{
- 'checked' if options.show_stddev}}><br>
+ 'checked' if options.show_stddev else ""}}><br>
<b>Show Linear Regression:</b>
<input type="checkbox" name="show_linear_regression" value="yes" {{
- 'checked' if options.show_linear_regression}}><br>
+ 'checked' if options.show_linear_regression else ""}}><br>
<b>Show Points For Failures:</b>
<input type="checkbox" name="show_failures" value="yes" {{
- 'checked' if options.show_failures}}><br>
+ 'checked' if options.show_failures else ""}}><br>
<b>Show Sample Points:</b>
<input type="checkbox" name="show_points" value="yes" {{
- 'checked' if options.show_points}}><br>
+ 'checked' if options.show_points else ""}}><br>
<b>Show All Sample Points:</b>
<input type="checkbox" name="show_all_points" value="yes" {{
- 'checked' if options.show_all_points}}><br>
+ 'checked' if options.show_all_points else ""}}><br>
<b>Normalize By Median:</b>
<input type="checkbox" name="normalize_by_median" value="yes" {{
- 'checked' if options.normalize_by_median}}><br>
+ 'checked' if options.normalize_by_median else ""}}><br>
{# Add all the hidden fields. #}
{% for name,value in request.args.items() %}
Modified: zorg/trunk/lnt/lnt/server/ui/templates/v4_run.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/v4_run.html?rev=151319&r1=151318&r2=151319&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/v4_run.html (original)
+++ zorg/trunk/lnt/lnt/server/ui/templates/v4_run.html Thu Feb 23 18:57:49 2012
@@ -64,7 +64,7 @@
{% if options.show_all_samples %}
<td>[
{%- for v in cr.get_samples() -%}
- {{ ", " if not loop.first }}
+ {{ ", " if not loop.first else "" }}
{{ "%.4f" % v }}
{%- endfor -%}]</td>
{% endif %}
@@ -83,31 +83,31 @@
<form action="" method="get">
<b>Show Delta:</b>
<input type="checkbox" name="show_delta" value="yes" {{
- "checked" if options.show_delta }}><br>
+ "checked" if options.show_delta else "" }}><br>
<b>Show Previous Value:</b>
<input type="checkbox" name="show_previous" value="yes" {{
- "checked" if options.show_previous }}><br>
+ "checked" if options.show_previous else "" }}><br>
<b>Show Standard Deviation:</b>
<input type="checkbox" name="show_stddev" value="yes" {{
- "checked" if options.show_stddev }}><br>
+ "checked" if options.show_stddev else "" }}><br>
<b>Show Median Absolute Deviation:</b>
<input type="checkbox" name="show_mad" value="yes" {{
- "checked" if options.show_mad }}><br>
+ "checked" if options.show_mad else "" }}><br>
<b>Show All Values:</b>
<input type="checkbox" name="show_all" value="yes" {{
- "checked" if options.show_all }}><br>
+ "checked" if options.show_all else "" }}><br>
<b>Show All Samples:</b>
<input type="checkbox" name="show_all_samples" value="yes" {{
- "checked" if options.show_all_samples }}><br>
+ "checked" if options.show_all_samples else "" }}><br>
<b>Show Sample Counts:</b>
<input type="checkbox" name="show_sample_counts" value="yes" {{
- "checked" if options.show_sample_counts }}><br>
+ "checked" if options.show_sample_counts else "" }}><br>
<b>Number of Comparison Runs:</b>
<input type="text" name="num_comparison_runs" value="{{
@@ -115,15 +115,15 @@
<b>Show Report Graphs:</b>
<input type="checkbox" name="show_graphs" value="yes" {{
- "checked" if options.show_graphs }}><br>
+ "checked" if options.show_graphs else "" }}><br>
<b>Show Data Table:</b>
<input type="checkbox" name="show_data_table" value="yes" {{
- "checked" if options.show_data_table }}><br>
+ "checked" if options.show_data_table else ""}}><br>
<b>Hide Report By Default:</b>
<input type="checkbox" name="hide_report_by_default" value="yes" {{
- "checked" if options.hide_report_by_default }}><br>
+ "checked" if options.hide_report_by_default else ""}}><br>
<b>Test Filter (regexp):</b>
<input type="text" name="test_filter" value="{{
@@ -158,7 +158,7 @@
{# Report one table for each primary field. #}
{% for field in primary_fields %}
-{{ utils.render_popup_begin('test_data.' + field.name, field.name) }}
+{{ utils.render_popup_begin('test_data.' + field.name, field.name, false) }}
<h4>{{field.name}}</h4>
<table class="sortable" border=1>
@@ -191,7 +191,7 @@
{% for test_name,test_id in test_info %}
{% set cr = request_info.sri.get_run_comparison_result(
- run, compare_to, test_id, field, comparison_window) %}
+ run, compare_to, test_id, field, request_info.comparison_window) %}
{% if cr.previous is not none or cr.current is not none %}
{% if cr.current is none or cr.current >= test_min_value_filter %}
<tr>
Modified: zorg/trunk/lnt/lnt/server/ui/templates/v4_utils.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/v4_utils.html?rev=151319&r1=151318&r2=151319&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/v4_utils.html (original)
+++ zorg/trunk/lnt/lnt/server/ui/templates/v4_utils.html Thu Feb 23 18:57:49 2012
@@ -38,10 +38,10 @@
{# Show a small number of neighboring runs. #}
{% for r in neighboring_runs %}
- <li>{{ "<h3>"|safe if r.id == run.id }}
+ <li>{{ "<h3>"|safe if r.id == run.id else "" }}
<a href="{{v4_url_for('v4_run', id=r.id)}}">{{
r.start_time}}</a>{{
- "</h3>"|safe if r.id == run.id }}
+ "</h3>"|safe if r.id == run.id else ""}}
{% endfor %}
</ul>
@@ -50,10 +50,10 @@
<h4>Compare To:</h4>
<ul>
{% for r in comparison_neighboring_runs %}
- <li>{{ "<h3>"|safe if r.id == compare_to.id }}
+ <li>{{ "<h3>"|safe if r.id == compare_to.id else "" }}
<a href="{{v4_url_for('v4_run', id=run.id, compare_to=r.id)}}">{{
r.start_time}}</a>{{
- "</h3>"|safe if r.id == compare_to.id }}
+ "</h3>"|safe if r.id == compare_to.id else ""}}
{% endfor %}
</ul>
{% endif %}
More information about the llvm-commits
mailing list