From c089fab880488fa9e99f4a03d1e621b5d350d040 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Feb 18 2020 10:09:04 +0000 Subject: move needed functions Related: https://pagure.io/koji/issue/1484 --- diff --git a/www/kojiweb/taskinfo.chtml b/www/kojiweb/taskinfo.chtml index ca8bf9a..c3dd1bb 100644 --- a/www/kojiweb/taskinfo.chtml +++ b/www/kojiweb/taskinfo.chtml @@ -3,39 +3,6 @@ #from six.moves.urllib.parse import quote #import datetime -#def printValue($key, $value, $sep=', ') - #if $key in ('brootid', 'buildroot_id') -$value - #elif $isinstance($value, list) -$sep.join([$str($val) for $val in $value]) - #elif $isinstance($value, dict) -$sep.join(['%s=%s' % (($n == '' and "''" or $n), $v) for $n, $v in $value.items()]) - #else -$value - #end if -#end def - -#def printProperties($props) - #echo ', '.join([$v is not None and '%s=%s' % ($n, $v) or $str($n) for $n, $v in $props.items()]) -#end def - -#def printMap($vals, $prefix='') - #for $key, $value in $vals.items() - #if $key == 'properties' - ${prefix}properties = $printProperties($value)
- #elif $key != '__starstar' - $prefix$key = $printValue($key, $value)
- #end if - #end for -#end def - -#def printOpts($opts) - #if $opts - Options:
- $printMap($opts, '  ') - #end if -#end def - #def printChildren($taskID, $childMap) #set $iter = 0 #set $children = $childMap[$str($taskID)] diff --git a/www/kojiweb/taskinfo_params.chtml b/www/kojiweb/taskinfo_params.chtml index b9992eb..eed2f6b 100644 --- a/www/kojiweb/taskinfo_params.chtml +++ b/www/kojiweb/taskinfo_params.chtml @@ -1,6 +1,39 @@ #import koji #from kojiweb import util +#def printValue($key, $value, $sep=', ') + #if $key in ('brootid', 'buildroot_id') +$value + #elif $isinstance($value, list) +$sep.join([$str($val) for $val in $value]) + #elif $isinstance($value, dict) +$sep.join(['%s=%s' % (($n == '' and "''" or $n), $v) for $n, $v in $value.items()]) + #else +$value + #end if +#end def + +#def printProperties($props) + #echo ', '.join([$v is not None and '%s=%s' % ($n, $v) or $str($n) for $n, $v in $props.items()]) +#end def + +#def printMap($vals, $prefix='') + #for $key, $value in $vals.items() + #if $key == 'properties' + ${prefix}properties = $printProperties($value)
+ #elif $key != '__starstar' + $prefix$key = $printValue($key, $value)
+ #end if + #end for +#end def + +#def printOpts($opts) + #if $opts + Options:
+ $printMap($opts, '  ') + #end if +#end def + #if $task.method == 'buildSRPMFromSCM' SCM URL: $params[0]
#if $len($params) > 1