summaryrefslogtreecommitdiffstats
path: root/external/poky/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
diff options
context:
space:
mode:
Diffstat (limited to 'external/poky/bitbake/lib/toaster/toastergui/templatetags/projecttags.py')
-rw-r--r--external/poky/bitbake/lib/toaster/toastergui/templatetags/projecttags.py25
1 files changed, 6 insertions, 19 deletions
diff --git a/external/poky/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/external/poky/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
index b170a161..c432f59a 100644
--- a/external/poky/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
+++ b/external/poky/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
@@ -1,25 +1,12 @@
#
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-#
# BitBake Toaster Implementation
#
# Copyright (C) 2013 Intel Corporation
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# SPDX-License-Identifier: GPL-2.0-only
#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-from datetime import datetime, timedelta
+from datetime import timedelta
from os.path import relpath
import re
from django import template
@@ -57,7 +44,7 @@ def json(value, default = None):
# it manually here
return mark_safe(JsonLib.dumps(value, indent=2, default = default, ensure_ascii=False).replace('</', '<\\/'))
-@register.assignment_tag
+@register.simple_tag
def query(qs, **kwargs):
""" template tag which allows queryset filtering. Usage:
{% query books author=author as mybooks %}
@@ -96,7 +83,7 @@ def divide(value, arg):
def multiply(value, arg):
return int(value) * int(arg)
-@register.assignment_tag
+@register.simple_tag
def datecompute(delta, start = timezone.now()):
return start + timedelta(delta)
@@ -225,7 +212,7 @@ def filtered_installedsize(size, installed_size):
"""If package.installed_size not null and not empty return it,
else return package.size
"""
- return size if (installed_size == 0) or (installed_size == "") or (installed_size == None) else installed_size
+ return size if (installed_size == 0) or (installed_size == "") or (installed_size is None) else installed_size
@register.filter
def filtered_packageversion(version, revision):
@@ -241,7 +228,7 @@ def filter_sizeovertotal(package_object, total_size):
formatted nicely.
"""
size = package_object.installed_size
- if size == None or size == '':
+ if size is None or size == '':
size = package_object.size
return '{:.1%}'.format(float(size)/float(total_size))