[Buildbot-commits] buildbot/buildbot/status/web base.py, 1.20, 1.21 build.py, 1.15, 1.16 builder.py, 1.15, 1.16

Brian Warner warner at users.sourceforge.net
Wed Nov 21 09:23:36 UTC 2007


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

Modified Files:
	base.py build.py builder.py 
Log Message:
[project @ more #138: factor out force/stop-build form generation]

Original author: warner at lothar.com
Date: 2007-11-21 08:59:44+00:00

Index: base.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/web/base.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- base.py	1 Nov 2007 08:33:37 -0000	1.20
+++ base.py	21 Nov 2007 09:23:34 -0000	1.21
@@ -53,6 +53,32 @@
     label = html.escape(label)
     return ROW_TEMPLATE % {"label": label, "field": field}
 
+def make_stop_form(stopURL):
+    data = """<form action="%s" class='command stopbuild'>
+      <p>To stop this build, fill out the following fields and
+      click the 'Stop' button</p>\n""" % stopURL
+    data += make_row("Your name:",
+                     "<input type='text' name='username' />")
+    data += make_row("Reason for stopping build:",
+                     "<input type='text' name='comments' />")
+    data += '<input type="submit" value="Stop Builder" /></form>\n'
+    return data
+
+def make_force_build_form(forceURL):
+    data = """<form action="%s" class="command forcebuild">
+      <p>To force a build, fill out the following fields and
+      click the 'Force Build' button</p>""" % forceURL
+    return (data
+      + make_row("Your name:",
+                 "<input type='text' name='username' />")
+      + make_row("Reason for build:",
+                 "<input type='text' name='comments' />")
+      + make_row("Branch to build:",
+                 "<input type='text' name='branch' />")
+      + make_row("Revision to build:",
+                 "<input type='text' name='revision' />")
+      + '<input type="submit" value="Force Build" /></form>\n')
+
 colormap = {
     'green': '#72ff75',
     }
@@ -149,7 +175,7 @@
         if parms.has_key('show_idle'):
             del parms['show_idle']
             self.show_idle = 1
-            
+
         self.parms = parms
         # parms is a dict of HTML parameters for the <td> element that will
         # represent this Event in the waterfall display.

Index: build.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/web/build.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- build.py	21 Nov 2007 09:22:49 -0000	1.15
+++ build.py	21 Nov 2007 09:23:34 -0000	1.16
@@ -5,8 +5,8 @@
 
 import urllib, time
 from twisted.python import log
-from buildbot.status.web.base import HtmlResource, make_row, css_classes, \
-     path_to_builder
+from buildbot.status.web.base import HtmlResource, make_row, make_stop_form, \
+     css_classes, path_to_builder
 
 from buildbot.status.web.tests import TestsResource
 from buildbot.status.web.step import StepsResource
@@ -48,17 +48,7 @@
 
             if self.build_control is not None:
                 stopURL = urllib.quote(req.childLink("stop"))
-                data += """
-                <form action="%s" class='command stopbuild'>
-                <p>To stop this build, fill out the following fields and
-                push the 'Stop' button</p>\n""" % stopURL
-                data += make_row("Your name:",
-                                 "<input type='text' name='username' />")
-                data += make_row("Reason for stopping build:",
-                                 "<input type='text' name='comments' />")
-                data += """<input type="submit" value="Stop Builder" />
-                </form>
-                """
+                data += make_stop_form(stopURL)
 
         if b.isFinished():
             results = b.getResults()

Index: builder.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/web/builder.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- builder.py	21 Nov 2007 09:22:49 -0000	1.15
+++ builder.py	21 Nov 2007 09:23:34 -0000	1.16
@@ -6,7 +6,8 @@
 import re, urllib, time
 from twisted.python import log
 from buildbot import interfaces
-from buildbot.status.web.base import HtmlResource, make_row, OneLineMixin
+from buildbot.status.web.base import HtmlResource, make_row, \
+     make_force_build_form, OneLineMixin
 from buildbot.process.base import BuildRequest
 from buildbot.sourcestamp import SourceStamp
 
@@ -106,23 +107,7 @@
 
         if control is not None and connected_slaves:
             forceURL = urllib.quote(req.childLink("force"))
-            data += (
-                """
-                <form action='%(forceURL)s' class='command forcebuild'>
-                <p>To force a build, fill out the following fields and
-                push the 'Force Build' button</p>"""
-                + make_row("Your name:",
-                           "<input type='text' name='username' />")
-                + make_row("Reason for build:",
-                           "<input type='text' name='comments' />")
-                + make_row("Branch to build:",
-                           "<input type='text' name='branch' />")
-                + make_row("Revision to build:",
-                           "<input type='text' name='revision' />")
-                + """
-                <input type='submit' value='Force Build' />
-                </form>
-                """) % {"forceURL": forceURL}
+            data += make_force_build_form(forceURL)
         elif control is not None:
             data += """
             <p>All buildslaves appear to be offline, so it's not possible





More information about the Commits mailing list