annotate bitten/trac_ext/web_ui.py @ 50:0d5ad32948b7

Restrict access to web interface with custom permission actions.
author cmlenz
date Sun, 26 Jun 2005 12:15:47 +0000
parents 083e848088ee
children 033366d81def
rev   line source
35
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
1 # -*- coding: iso8859-1 -*-
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
2 #
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
3 # Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
4 #
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
5 # Bitten is free software; you can redistribute it and/or
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
6 # modify it under the terms of the GNU General Public License as
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
7 # published by the Free Software Foundation; either version 2 of the
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
8 # License, or (at your option) any later version.
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
9 #
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
10 # Trac is distributed in the hope that it will be useful,
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
13 # General Public License for more details.
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
14 #
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
15 # You should have received a copy of the GNU General Public License
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
16 # along with this program; if not, write to the Free Software
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
18 #
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
19 # Author: Christopher Lenz <cmlenz@gmx.de>
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
20
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
21 import re
50
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
22 from time import localtime, strftime
35
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
23
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
24 from trac.core import *
47
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
25 from trac.util import escape, pretty_timedelta
35
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
26 from trac.web.chrome import INavigationContributor
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
27 from trac.web.main import IRequestHandler
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
28 from trac.wiki import wiki_to_html
47
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
29 from bitten.model import Build, BuildConfig
35
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
30
50
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
31
35
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
32 class BuildModule(Component):
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
33
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
34 implements(INavigationContributor, IRequestHandler)
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
35
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
36 build_cs = """
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
37 <?cs include:"header.cs" ?>
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
38 <div id="ctxtnav" class="nav"></div>
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
39 <div id="content" class="build">
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
40 <h1><?cs var:title ?></h1><?cs
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
42 if:build.mode == 'overview' ?><?cs
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
43 each:config = build.configs ?>
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
44 <h2><a href="<?cs var:config.href ?>"><?cs var:config.label ?></a></h2><?cs
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
45 if:config.description ?><div class="description"><?cs
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
46 var:config.description ?></div><?cs
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
47 /if ?><?cs
50
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
48 /each ?><?cs
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
49 if:build.can_create ?><div class="buttons">
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
50 <form method="get" action=""><div>
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
51 <input type="hidden" name="action" value="new" />
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
52 <input type="submit" value="Add new configuration" />
50
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
53 </div></form><?cs
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
54 /if ?></div><?cs
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
55
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
56 elif:build.mode == 'edit_config' ?>
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
57 <form method="post" action="">
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
58 <div class="field"><label>Name:<br />
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
59 <input type="text" name="name" value="<?cs var:build.config.name ?>" />
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
60 </label></div>
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
61 <div class="field"><label>Label (for display):<br />
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
62 <input type="text" name="label" size="32" value="<?cs
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
63 var:build.config.label ?>" />
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
64 </label></div>
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
65 <div class="field"><label><input type="checkbox" name="active"<?cs
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
66 if:build.config.active ?> checked="checked" <?cs /if ?>/> Active
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
67 </label></div>
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
68 <div class="field"><label>Repository path:<br />
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
69 <input type="text" name="path" size="48" value="<?cs
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
70 var:build.config.path ?>" />
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
71 </label></div>
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
72 <div class="field"><fieldset class="iefix">
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
73 <label for="description">Description (you may use <a tabindex="42" href="<?cs
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
74 var:trac.href.wiki ?>/WikiFormatting">WikiFormatting</a> here):</label>
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
75 <p><textarea id="description" name="description" class="wikitext" rows="10" cols="78"><?cs
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
76 var:build.config.description ?></textarea></p>
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
77 <script type="text/javascript" src="<?cs
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
78 var:htdocs_location ?>js/wikitoolbar.js"></script>
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
79 </fieldset></div>
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
80 <div class="buttons">
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
81 <input type="hidden" name="action" value="<?cs
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
82 if:build.config.exists ?>edit<?cs else ?>new<?cs /if ?>" />
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
83 <input type="submit" name="cancel" value="Cancel" />
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
84 <input type="submit" value="<?cs
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
85 if:build.config.exists ?>Save changes<?cs else ?>Create<?cs /if ?>" />
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
86 </div>
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
87 </form><?cs
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
88
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
89 elif:build.mode == 'view_config' ?><ul>
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
90 <li>Active: <?cs if:build.config.active ?>yes<?cs else ?>no<?cs /if ?></li>
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
91 <li>Path: <?cs if:build.config.path ?><a href="<?cs
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
92 var:build.config.browser_href ?>"><?cs
47
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
93 var:build.config.path ?></a></li><?cs /if ?></ul><?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
94 if:build.config.description ?><div class="description"><?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
95 var:build.config.description ?></div><?cs /if ?>
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
96 <div id="builds"><h3>Builds</h3><?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
97 if:len(build.config.builds) ?><ul><?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
98 each:b = build.config.builds ?><li><a href="<?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
99 var:b.href ?>">[<?cs var:b.rev ?>]</a> built by <?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
100 var:len(b.slaves) ?> slave(s)<?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
101 if:len(b.slaves) ?>:<ul><?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
102 each:slave = b.slaves ?><li><strong><?cs var:slave.name ?></strong>: <?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
103 var:slave.status ?> (started <?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
104 var:slave.started_delta ?> ago<?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
105 if:slave.stopped ?>, stopped <?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
106 var:slave.stopped_delta ?> ago, took <?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
107 var:slave.duration ?><?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
108 /if ?>)</li><?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
109 /each ?>
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
110 </ul><?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
111 /if ?>
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
112 </li><?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
113 /each ?>
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
114 </ul><?cs
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
115 else ?><p>None</p><?cs
50
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
116 /if ?></div><?cs
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
117 if:build.can_modify ?><div class="buttons">
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
118 <form method="get" action=""><div>
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
119 <input type="hidden" name="action" value="edit" />
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
120 <input type="submit" value="Edit configuration" />
50
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
121 </div></form><?cs
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
122 /if ?></div><?cs
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
123 /if ?>
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
124
35
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
125 </div>
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
126 <?cs include:"footer.cs" ?>
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
127 """
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
128
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
129 # INavigationContributor methods
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
130
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
131 def get_active_navigation_item(self, req):
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
132 return 'build'
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
133
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
134 def get_navigation_items(self, req):
50
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
135 if not req.perm.has_permission('BUILD_VIEW'):
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
136 return
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
137 yield 'mainnav', 'build', \
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
138 '<a href="%s" accesskey="5">Build Status</a>' \
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
139 % self.env.href.build()
35
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
140
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
141 # IRequestHandler methods
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
142
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
143 def match_request(self, req):
47
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
144 match = re.match(r'/build(?:/([\w.-]+))?(?:/([\w+.-]))?', req.path_info)
35
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
145 if match:
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
146 if match.group(1):
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
147 req.args['config'] = match.group(1)
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
148 if match.group(2):
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
149 req.args['id'] = match.group(2)
35
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
150 return True
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
151
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
152 def process_request(self, req):
50
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
153 req.perm.assert_permission('BUILD_VIEW')
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
154
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
155 action = req.args.get('action')
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
156 config = req.args.get('config')
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
157 id = req.args.get('id')
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
158
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
159 if req.method == 'POST':
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
160 if not config and action == 'new':
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
161 self._do_create(req)
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
162 elif config and action == 'edit':
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
163 self._do_save(req, config)
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
164 else:
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
165 if not config:
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
166 if action == 'new':
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
167 self._render_config_form(req)
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
168 else:
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
169 self._render_overview(req)
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
170 elif not id:
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
171 if action == 'edit':
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
172 self._render_config_form(req, config)
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
173 else:
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
174 self._render_config(req, config)
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
175 else:
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
176 self._render_build(req, config, id)
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
177
35
67631e1d4d45 Some stubbed out code for the Bitten/Trac-integration. This creates a {{{bitten_build}}} table on database upgrade after the plugin is enabled.
cmlenz
parents:
diff changeset
178 return req.hdf.parse(self.build_cs), None
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
179
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
180 def _do_create(self, req):
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
181 """Create a new build configuration."""
50
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
182 req.perm.assert_permission('BUILD_CREATE')
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
183
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
184 if 'cancel' in req.args.keys():
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
185 req.redirect(self.env.href.build())
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
186
45
80bc0fae3ed1 Renamed {{{Configuration}}} to {{{BuildConfig}}}.
cmlenz
parents: 41
diff changeset
187 config = BuildConfig(self.env)
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
188 config.name = req.args.get('name')
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
189 config.active = req.args.has_key('active')
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
190 config.label = req.args.get('label', '')
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
191 config.path = req.args.get('path', '')
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
192 config.description = req.args.get('description', '')
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
193 config.insert()
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
194
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
195 req.redirect(self.env.href.build(config.name))
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
196
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
197 def _do_save(self, req, config_name):
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
198 """Save changes to a build configuration."""
50
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
199 req.perm.assert_permission('BUILD_MODIFY')
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
200
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
201 if 'cancel' in req.args.keys():
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
202 req.redirect(self.env.href.build(config_name))
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
203
45
80bc0fae3ed1 Renamed {{{Configuration}}} to {{{BuildConfig}}}.
cmlenz
parents: 41
diff changeset
204 config = BuildConfig(self.env, config_name)
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
205 config.name = req.args.get('name')
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
206 config.active = req.args.has_key('active')
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
207 config.label = req.args.get('label', '')
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
208 config.path = req.args.get('path', '')
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
209 config.description = req.args.get('description', '')
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
210 config.update()
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
211
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
212 req.redirect(self.env.href.build(config.name))
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
213
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
214 def _render_overview(self, req):
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
215 req.hdf['title'] = 'Build Status'
45
80bc0fae3ed1 Renamed {{{Configuration}}} to {{{BuildConfig}}}.
cmlenz
parents: 41
diff changeset
216 configurations = BuildConfig.select(self.env, include_inactive=True)
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
217 for idx, config in enumerate(configurations):
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
218 description = config.description
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
219 if description:
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
220 description = wiki_to_html(description, self.env, req)
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
221 req.hdf['build.configs.%d' % idx] = {
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
222 'name': config.name, 'label': config.label or config.name,
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
223 'path': config.path, 'description': description,
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
224 'href': self.env.href.build(config.name)
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
225 }
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
226 req.hdf['build.mode'] = 'overview'
50
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
227 req.hdf['build.can_create'] = req.perm.has_permission('BUILD_CREATE')
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
228
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
229 def _render_config(self, req, config_name):
45
80bc0fae3ed1 Renamed {{{Configuration}}} to {{{BuildConfig}}}.
cmlenz
parents: 41
diff changeset
230 config = BuildConfig(self.env, config_name)
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
231 req.hdf['title'] = 'Build Configuration "%s"' \
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
232 % escape(config.label or config.name)
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
233 description = config.description
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
234 if description:
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
235 description = wiki_to_html(description, self.env, req)
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
236 req.hdf['build.config'] = {
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
237 'name': config.name, 'label': config.label, 'path': config.path,
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
238 'active': config.active, 'description': description,
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
239 'browser_href': self.env.href.browser(config.path)
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
240 }
47
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
241
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
242 builds = Build.select(self.env, config=config.name)
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
243 curr_rev = None
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
244 slave_idx = 0
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
245 for idx, build in enumerate(builds):
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
246 if build.rev != curr_rev:
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
247 slave_idx = 0
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
248 curr_rev = build.rev
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
249 req.hdf['build.config.builds.%d' % idx] = {
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
250 'rev': build.rev,
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
251 'href': self.env.href.changeset(build.rev)
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
252 }
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
253 if not build.slave:
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
254 continue
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
255 status_label = {Build.PENDING: 'pending',
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
256 Build.IN_PROGRESS: 'in progress',
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
257 Build.SUCCESS: 'success', Build.FAILURE: 'failed'}
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
258 prefix = 'build.config.builds.%d.slaves.%d' % (idx, slave_idx)
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
259 req.hdf[prefix] = {'name': build.slave,
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
260 'status': status_label[build.status]}
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
261 if build.time:
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
262 started = build.time
50
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
263 req.hdf[prefix + '.started'] = strftime('%x %X',
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
264 localtime(started))
47
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
265 req.hdf[prefix + '.started_delta'] = pretty_timedelta(started)
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
266 if build.duration:
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
267 stopped = build.time + build.duration
50
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
268 req.hdf[prefix + '.duration'] = pretty_timedelta(stopped,
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
269 build.time)
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
270 req.hdf[prefix + '.stopped'] = strftime('%x %X',
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
271 localtime(stopped))
47
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
272 req.hdf[prefix + '.stopped_delta'] = pretty_timedelta(stopped)
083e848088ee * Improvements to the model classes, and a couple of unit tests.
cmlenz
parents: 45
diff changeset
273
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
274 req.hdf['build.mode'] = 'view_config'
50
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
275 req.hdf['build.can_modify'] = req.perm.has_permission('BUILD_MODIFY')
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
276
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
277 def _render_config_form(self, req, config_name=None):
45
80bc0fae3ed1 Renamed {{{Configuration}}} to {{{BuildConfig}}}.
cmlenz
parents: 41
diff changeset
278 config = BuildConfig(self.env, config_name)
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
279 if config.exists:
50
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
280 req.perm.assert_permission('BUILD_MODIFY')
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
281 req.hdf['title'] = 'Edit Build Configuration "%s"' \
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
282 % escape(config.label or config.name)
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
283 req.hdf['build.config'] = {
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
284 'name': config.name, 'label': config.label, 'path': config.path,
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
285 'active': config.active, 'description': config.description,
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
286 'exists': config.exists
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
287 }
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
288 else:
50
0d5ad32948b7 Restrict access to web interface with custom permission actions.
cmlenz
parents: 47
diff changeset
289 req.perm.assert_permission('BUILD_CREATE')
41
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
290 req.hdf['title'] = 'Create Build Configuration'
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
291 req.hdf['build.mode'] = 'edit_config'
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
292
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
293 def _render_build(self, req, config_name, build_id):
16b30ffc5fb9 Add web interface for viewing and managing build configurations. Closes #9.
cmlenz
parents: 35
diff changeset
294 raise NotImplementedError, 'Not implemented yet'
Copyright (C) 2012-2017 Edgewall Software