Simplify handling of old build limit showing.
authorJelmer Vernooij <jelmer@samba.org>
Sat, 7 Jun 2014 16:32:33 +0000 (18:32 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 7 Jun 2014 16:32:33 +0000 (18:32 +0200)
buildfarm/web/__init__.py

index 08d577a1ba3402c676d8a2dda53aedf2efc4cf2a..8f15f54baaa05263e386c3bf3c5812789cc957ae 100755 (executable)
@@ -404,7 +404,7 @@ class BuildFarmPage(object):
 
 class ViewBuildPage(BuildFarmPage):
 
-    def show_oldrevs(self, myself, build, host, compiler, limit):
+    def show_oldrevs(self, myself, build, host, compiler, limit=None):
         """show the available old revisions, if any"""
 
         tree = build.tree
@@ -419,11 +419,7 @@ class ViewBuildPage(BuildFarmPage):
         yield "<thead><tr><th>Revision</th><th>Status</th><th>Age</th></tr></thead>\n"
         yield "<tbody>\n"
 
-        nb = 0
-        for old_build in old_builds:
-            if limit >= 0 and nb >= limit:
-                break
-            nb = nb + 1
+        for old_build in old_builds[:limit]:
             yield "<tr><td>%s</td><td>%s</td><td>%s</td></tr>\n" % (
                 revision_link(myself, old_build.revision, tree),
                 build_link(myself, old_build),