summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2016-01-04 17:38:17 -0800
committerDylan Baker <baker.dylan.c@gmail.com>2016-02-08 12:29:34 -0800
commita55abb88e0893b9b40392d04467880072c42109a (patch)
tree1a79e56938706375a48c9d0eab33e6f19034b798 /templates
parentb4a47de0cee7183bba278b1996afdd01069dd220 (diff)
python: use six.{iter,view}{items,keys,values}
This was initially generated via the following sed command: sed -i \ -e 's@in \(.*\)\.iter\(values,keys,items\)()@in six.iter\2(\1)@g' \ -e 's@in \(.*\..*\)\.iter\(values,keys,items\)()@in six.iter\2(\1)@g' Then cleaned up by hand, including changes for view*. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'templates')
-rw-r--r--templates/index.mako5
-rw-r--r--templates/testrun_info.mako7
2 files changed, 8 insertions, 4 deletions
diff --git a/templates/index.mako b/templates/index.mako
index 690206fdf..39f4976b4 100644
--- a/templates/index.mako
+++ b/templates/index.mako
@@ -3,6 +3,7 @@
import posixpath # this must be posixpath, since we want /'s not \'s
import re
+ import six
from six.moves import range
from framework import grouptools, status
@@ -23,7 +24,7 @@
return status.NOTRUN
return max([status.status_lookup(s) for s, v in
- result.totals[group].iteritems() if v > 0])
+ six.iteritems(result.totals[group]) if v > 0])
def group_fraction(result, group):
"""Get the fraction value for a group."""
@@ -32,7 +33,7 @@
num = 0
den = 0
- for k, v in result.totals[group].iteritems():
+ for k, v in six.iteritems(result.totals[group]):
if v > 0:
s = status.status_lookup(k)
num += s.fraction[0] * v
diff --git a/templates/testrun_info.mako b/templates/testrun_info.mako
index f8e1b4773..473897a29 100644
--- a/templates/testrun_info.mako
+++ b/templates/testrun_info.mako
@@ -1,3 +1,6 @@
+<%!
+ import six
+%>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//END"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -21,10 +24,10 @@
<td>totals</td>
<td>
<table>
- % for key, value in sorted(totals.iteritems(), key=lambda (k,v): (v,k), reverse=True):
+ % for key, value in sorted(six.iteritems(totals), key=lambda i: (i[1], i[0]), reverse=True):
<tr><td>${key}</td><td>${value}</td></tr>
% endfor
- <tr><td>total</td><td>${sum(totals.itervalues())}</td></tr>
+ <tr><td>total</td><td>${sum(six.itervalues(totals))}</td></tr>
</table>
</td>
</tr>