"""
value=re.sub('_\$.*', '', value)
return re.sub('_[a-z].*', '', value)
-
+
@register.filter
def filter_setin_files(file_list,matchstr):
""" filter/search the 'set in' file lists. Note
the <p> marks, but this is safe as the data
is file paths
"""
-
+
# no filters, show last file (if any)
if matchstr == ":":
if file_list:
htmlstr=""
# match only filters
if search == '':
- for i in range(len(file_list)):
+ for i in range(len(file_list)):
if re.search(filter, file_list[i].file_name):
if htmlstr.find(file_list[i].file_name + "<p>") < 0:
htmlstr += file_list[i].file_name + "<p>"
return htmlstr
-
+
# match only search string, plus always last file
if filter == "":
- for i in range(len(file_list)-1):
+ for i in range(len(file_list)-1):
if re.search(search,file_list[i].file_name):
if htmlstr.find(file_list[i].file_name + "<p>") < 0:
htmlstr += file_list[i].file_name + "<p>"
if htmlstr.find(file_list[len(file_list)-1].file_name) < 0:
htmlstr += file_list[len(file_list)-1].file_name
return htmlstr
-
+
# match filter or search string
- for i in range(len(file_list)):
+ for i in range(len(file_list)):
if re.search(filter, file_list[i].file_name) or re.search(search,file_list[i].file_name):
if htmlstr.find(file_list[i].file_name + "<p>") < 0:
htmlstr += file_list[i].file_name + "<p>"
else ""
"""
return "" if (not version or version == "") else version if (not revision or revision == "") else version + "-" + revision
-
+
@register.filter
def filter_sizeovertotal(package_object, total_size):
""" Return the % size of the package over the total size argument
size = package_object.installed_size
if size == None or size == '':
size = package_object.size
-
+
return '{:.1%}'.format(float(size)/float(total_size))
from django.utils.safestring import mark_safe
ndx = 0;
f = i.file_name[ ndx + 1: ]
imageFiles.append({ 'path': f, 'size' : i.file_size })
- if ( t.is_image and
+ if ( t.is_image and
(( len( imageFiles ) <= 0 ) or ( len( t.license_manifest_path ) <= 0 ))):
targetHasNoImages = True
elem[ 'imageFiles' ] = imageFiles
}
if request.GET.get( 'show_matches', "" ):
context[ 'showing_matches' ] = True
- context[ 'matching_tasks' ] = Task.objects.filter(
- sstate_checksum=task.sstate_checksum ).filter(
+ context[ 'matching_tasks' ] = Task.objects.filter(
+ sstate_checksum=task.sstate_checksum ).filter(
build__completed_on__lt=task.build.completed_on).exclude(
order__isnull=True).exclude(outcome=Task.OUTCOME_NA).order_by('-build__completed_on')
mandatory_parameters = { 'count': 25, 'page' : 1, 'orderby':'name:+'};
retval = _verify_parameters( request.GET, mandatory_parameters )
if retval:
- return _redirect_parameters(
- variant, request.GET, mandatory_parameters,
+ return _redirect_parameters(
+ variant, request.GET, mandatory_parameters,
build_id = build_id, target_id = target_id )
( filter_string, search_term, ordering_string ) = _search_tuple( request, Package )
# FUTURE: get rid of nested sub-queries replacing with ManyToMany field
queryset = Package.objects.filter(
- size__gte = 0,
+ size__gte = 0,
id__in = Target_Installed_Package.objects.filter(
target_id=target_id ).values( 'package_id' ))
packages_sum = queryset.aggregate( Sum( 'installed_size' ))
'clclass' : 'layer_directory',
'hidden' : 1,
}
- context = {
+ context = {
'objectname': variant,
'build' : Build.objects.filter( pk = build_id )[ 0 ],
'target' : Target.objects.filter( pk = target_id )[ 0 ],