]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toaster: use // operator instead of /
authorEd Bartosh <ed.bartosh@linux.intel.com>
Mon, 30 May 2016 12:51:20 +0000 (15:51 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 1 Jun 2016 14:28:23 +0000 (15:28 +0100)
Division operator works differently in Python 3. It results in
float unlike in Python 2, where it results in int.

Explicitly used "floor division" operator instead of 'division'
operator. This should make the code to result in integer under
both pythons.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/toaster/orm/models.py
lib/toaster/toastergui/templatetags/projecttags.py

index dd6466471de24c40d878b0a4cd115b33a2033d6f..25bc1dbe151adc14687661aed6972f00246bc106 100644 (file)
@@ -424,7 +424,7 @@ class Build(models.Model):
         tf = Task.objects.filter(build = self)
         tfc = tf.count()
         if tfc > 0:
-            completeper = tf.exclude(order__isnull=True).count()*100/tfc
+            completeper = tf.exclude(order__isnull=True).count()*100 // tfc
         else:
             completeper = 0
         return completeper
index 75f2261be8cf1b2d318f6536577b971229e81f4f..1d680365adc7eab0fe9be05acbc0a39dd9dc166e 100644 (file)
@@ -90,7 +90,7 @@ def whitespace_space_filter(value, arg):
 def divide(value, arg):
     if int(arg) == 0:
         return -1
-    return int(value) / int(arg)
+    return int(value) // int(arg)
 
 @register.filter
 def multiply(value, arg):