[PATCH 1/2] preserve latest behavior for non-integer, non-boolean "true" values, and update comment.

Mike McLean mikem at redhat.com
Fri Feb 20 17:23:11 UTC 2015


---
 hub/kojihub.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hub/kojihub.py b/hub/kojihub.py
index bb7d72a..a6360af 100644
--- a/hub/kojihub.py
+++ b/hub/kojihub.py
@@ -1133,6 +1133,9 @@ def readTaggedBuilds(tag,event=None,inherit=False,latest=False,package=None,owne
     # build - id pkg_id version release epoch
     # tag_listing - id build_id tag_id
 
+    if not isinstance(latest, (int, long, float)):
+        latest = bool(latest)
+
     taglist = [tag]
     if inherit:
         taglist += [link['parent_id'] for link in readFullInheritance(tag, event)]
@@ -1208,7 +1211,8 @@ def readTaggedBuilds(tag,event=None,inherit=False,latest=False,package=None,owne
                 continue
             if latest:
                 if (latest is True and seen.has_key(pkgid)) or seen.get(pkgid, 0) >= latest:
-                    #only take the first (note ordering in query above)
+                    # only take the first N entries
+                    # (note ordering in query above)
                     continue
                 seen[pkgid] = seen.get(pkgid, 0) + 1
             builds.append(build)
-- 
1.9.3



More information about the buildsys mailing list