As per feedback here:
https://lists.fedoraproject.org/pipermail/buildsys/2015-May/004684.html
Signed-off-by: Ralph Bean <rbean(a)redhat.com>
---
www/lib/kojiweb/util.py | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/www/lib/kojiweb/util.py b/www/lib/kojiweb/util.py
index 7f7b578..214b586 100644
--- a/www/lib/kojiweb/util.py
+++ b/www/lib/kojiweb/util.py
@@ -463,15 +463,13 @@ def taskScratchClass(task_object):
""" Return a css class indicating whether or not this task is a
scratch
build.
"""
- # Here, we try to figure out if this is supposed to be a scratch task based
- # on this 'request' list attached to the task object. It's hard to know
- # exactly what's in it, because it's an unstructured list. Different kinds
- # of tasks stuff different things in it in different places.
+ method = task_object['method']
request = task_object['request']
- if len(request) >= 3:
+ if method == 'build' and len(request) >= 3:
+ # Each task method has its own signature for what gets put in the
+ # request list. Builds should have an `opts` dict at index 2.
+ # See www/kojiweb/taskinfo.chtml for the grimoire.
opts = request[2]
- # This is tough, because "opts" could be a one of a number of
different
- # things. A dict, a bool, None, etc..
if hasattr(opts, 'get') and opts.get('scratch'):
return "scratch"
return ""
--
2.1.0