[Buildbot-commits] buildbot/buildbot/status/web waterfall.py, 1.27, 1.28

Brian Warner warner at users.sourceforge.net
Sun Mar 30 02:27:56 UTC 2008


Update of /cvsroot/buildbot/buildbot/buildbot/status/web
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19866/buildbot/status/web

Modified Files:
	waterfall.py 
Log Message:
[project @ waterfall: add category= argument, to filter builders by category. Closes #117.]

Original author: warner at lothar.com
Date: 2008-03-30 02:27:09+00:00

Index: waterfall.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/web/waterfall.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- waterfall.py	21 Mar 2008 04:25:35 -0000	1.27
+++ waterfall.py	30 Mar 2008 02:27:53 -0000	1.28
@@ -453,21 +453,29 @@
         phase = request.args.get("phase",["2"])
         phase = int(phase[0])
 
+        # we start with all Builders available to this Waterfall: this is
+        # limited by the config-file -time categories= argument, and defaults
+        # to all defined Builders.
+        allBuilderNames = status.getBuilderNames(categories=self.categories)
+        builders = [status.getBuilder(name) for name in allBuilderNames]
+
+        # but if the URL has one or more builder= arguments (or the old show=
+        # argument, which is still accepted for backwards compatibility), we
+        # use that set of builders instead. We still don't show anything
+        # outside the config-file time set limited by categories=.
         showBuilders = request.args.get("show", [])
         showBuilders.extend(request.args.get("builder", []))
-        allBuilders = status.getBuilderNames(categories=self.categories)
         if showBuilders:
-            builderNames = []
-            for b in showBuilders:
-                if b not in allBuilders:
-                    continue
-                if b in builderNames:
-                    continue
-                builderNames.append(b)
-        else:
-            builderNames = allBuilders
-        builders = map(lambda name: status.getBuilder(name),
-                       builderNames)
+            builders = [b for b in builders if b.name in showBuilders]
+
+        # now, if the URL has one or category= arguments, use them as a
+        # filter: only show those builders which belong to one of the given
+        # categories.
+        showCategories = request.args.get("category", [])
+        if showCategories:
+            builders = [b for b in builders if b.category in showCategories]
+
+        builderNames = [b.name for b in builders]
 
         if phase == -1:
             return self.body0(request, builders)





More information about the Commits mailing list