annotate bitten/admin.py @ 609:022bcceb90b7

0.6dev: Removing whitespace from target platform rules admin. Fixes #336.
author osimons
date Sat, 01 Aug 2009 00:48:47 +0000
parents 5d396356bf7a
children 0c11c58d1985
rev   line source
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
1 # -*- coding: utf-8 -*-
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
2 #
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
3 # Copyright (C) 2007 Edgewall Software
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
4 # All rights reserved.
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
5 #
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
6 # This software is licensed as described in the file COPYING, which
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
7 # you should have received as part of this distribution. The terms
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
8 # are also available at http://bitten.edgewall.org/wiki/License.
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
9
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
10 """Implementation of the web administration interface."""
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
11
432
74c51f648466 Started some tests for the new admin interface.
cmlenz
parents: 431
diff changeset
12 from pkg_resources import require, DistributionNotFound
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
13 import re
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
14
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
15 from trac.core import *
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 468
diff changeset
16 from trac.admin import IAdminPanelProvider
557
b4d3d9cbf200 Alter the appearance of the ''Build Status'' button, to show the current build status [eblot] - fixes #373
dfraser
parents: 516
diff changeset
17 from trac.web.chrome import add_stylesheet, add_script
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
18
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
19 from bitten.model import BuildConfig, TargetPlatform
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
20 from bitten.recipe import Recipe, InvalidRecipeError
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
21 from bitten.util import xmlio
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
22
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
23
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
24 class BuildMasterAdminPageProvider(Component):
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
25 """Web administration panel for configuring the build master."""
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
26
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 468
diff changeset
27 implements(IAdminPanelProvider)
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
28
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 468
diff changeset
29 # IAdminPanelProvider methods
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
30
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 468
diff changeset
31 def get_admin_panels(self, req):
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
32 if req.perm.has_permission('BUILD_ADMIN'):
432
74c51f648466 Started some tests for the new admin interface.
cmlenz
parents: 431
diff changeset
33 yield ('bitten', 'Builds', 'master', 'Master Settings')
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
34
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 468
diff changeset
35 def render_admin_panel(self, req, cat, page, path_info):
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
36 from bitten.master import BuildMaster
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
37 master = BuildMaster(self.env)
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
38
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
39 if req.method == 'POST':
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
40 self._save_config_changes(req, master)
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
41 req.redirect(req.abs_href.admin(cat, page))
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
42
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 468
diff changeset
43 data = {'master': master}
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
44 add_stylesheet(req, 'bitten/admin.css')
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 468
diff changeset
45 return 'bitten_admin_master.html', data
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
46
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
47 # Internal methods
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
48
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
49 def _save_config_changes(self, req, master):
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
50 changed = False
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
51
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
52 build_all = 'build_all' in req.args
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
53 if build_all != master.build_all:
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
54 self.config['bitten'].set('build_all',
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
55 build_all and 'yes' or 'no')
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
56 changed = True
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
57
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
58 adjust_timestamps = 'adjust_timestamps' in req.args
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
59 if adjust_timestamps != master.adjust_timestamps:
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
60 self.config['bitten'].set('adjust_timestamps',
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
61 adjust_timestamps and 'yes' or 'no')
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
62 changed = True
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
63
468
44c2b4ac6157 Add stabilization time parameter to build master. Closes #189. Many thanks to Allen Bierbaum for the patch.
cmlenz
parents: 467
diff changeset
64 stabilize_wait = int(req.args.get('stabilize_wait', 0))
44c2b4ac6157 Add stabilization time parameter to build master. Closes #189. Many thanks to Allen Bierbaum for the patch.
cmlenz
parents: 467
diff changeset
65 if stabilize_wait != master.stabilize_wait:
44c2b4ac6157 Add stabilization time parameter to build master. Closes #189. Many thanks to Allen Bierbaum for the patch.
cmlenz
parents: 467
diff changeset
66 self.config['bitten'].set('stabilize_wait', str(stabilize_wait))
44c2b4ac6157 Add stabilization time parameter to build master. Closes #189. Many thanks to Allen Bierbaum for the patch.
cmlenz
parents: 467
diff changeset
67 changed = True
44c2b4ac6157 Add stabilization time parameter to build master. Closes #189. Many thanks to Allen Bierbaum for the patch.
cmlenz
parents: 467
diff changeset
68
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
69 slave_timeout = int(req.args.get('slave_timeout', 0))
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
70 if slave_timeout != master.slave_timeout:
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
71 self.config['bitten'].set('slave_timeout', str(slave_timeout))
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
72 changed = True
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
73
557
b4d3d9cbf200 Alter the appearance of the ''Build Status'' button, to show the current build status [eblot] - fixes #373
dfraser
parents: 516
diff changeset
74 quick_status = 'quick_status' in req.args
b4d3d9cbf200 Alter the appearance of the ''Build Status'' button, to show the current build status [eblot] - fixes #373
dfraser
parents: 516
diff changeset
75 if quick_status != master.quick_status:
b4d3d9cbf200 Alter the appearance of the ''Build Status'' button, to show the current build status [eblot] - fixes #373
dfraser
parents: 516
diff changeset
76 self.config['bitten'].set('quick_status',
b4d3d9cbf200 Alter the appearance of the ''Build Status'' button, to show the current build status [eblot] - fixes #373
dfraser
parents: 516
diff changeset
77 quick_status and 'yes' or 'no')
b4d3d9cbf200 Alter the appearance of the ''Build Status'' button, to show the current build status [eblot] - fixes #373
dfraser
parents: 516
diff changeset
78 changed = True
b4d3d9cbf200 Alter the appearance of the ''Build Status'' button, to show the current build status [eblot] - fixes #373
dfraser
parents: 516
diff changeset
79
516
2f3b7c17d3c3 Switch to storing log messages in files rather than in database rows:
dfraser
parents: 503
diff changeset
80 logs_dir = req.args.get('logs_dir', None)
2f3b7c17d3c3 Switch to storing log messages in files rather than in database rows:
dfraser
parents: 503
diff changeset
81 if logs_dir != master.logs_dir:
2f3b7c17d3c3 Switch to storing log messages in files rather than in database rows:
dfraser
parents: 503
diff changeset
82 self.config['bitten'].set('logs_dir', str(logs_dir))
2f3b7c17d3c3 Switch to storing log messages in files rather than in database rows:
dfraser
parents: 503
diff changeset
83 changed = True
2f3b7c17d3c3 Switch to storing log messages in files rather than in database rows:
dfraser
parents: 503
diff changeset
84
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
85 if changed:
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
86 self.config.save()
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
87
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
88 return master
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
89
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
90
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
91 class BuildConfigurationsAdminPageProvider(Component):
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
92 """Web administration panel for configuring the build master."""
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
93
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 468
diff changeset
94 implements(IAdminPanelProvider)
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
95
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 468
diff changeset
96 # IAdminPanelProvider methods
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
97
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 468
diff changeset
98 def get_admin_panels(self, req):
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
99 if req.perm.has_permission('BUILD_MODIFY'):
432
74c51f648466 Started some tests for the new admin interface.
cmlenz
parents: 431
diff changeset
100 yield ('bitten', 'Builds', 'configs', 'Configurations')
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
101
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 468
diff changeset
102 def render_admin_panel(self, req, cat, page, path_info):
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
103 data = {}
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
104
467
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
105 # Analyze url
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
106 try:
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
107 config_name, platform_id = path_info.split('/', 1)
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
108 except:
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
109 config_name = path_info
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
110 platform_id = None
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
111
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
112 if config_name: # Existing build config
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 468
diff changeset
113 if platform_id or (
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 468
diff changeset
114 # Editing or creating one of the config's target platforms
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
115 req.method == 'POST' and 'new' in req.args):
467
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
116
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
117 if platform_id: # Editing target platform
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
118 platform_id = int(platform_id)
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
119 platform = TargetPlatform.fetch(self.env, platform_id)
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
120
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
121 if req.method == 'POST':
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
122 if 'cancel' in req.args or \
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
123 self._update_platform(req, platform):
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
124 req.redirect(req.abs_href.admin(cat, page,
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
125 config_name))
467
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
126 else: # creating target platform
607
5d396356bf7a 0.6dev: Reworked UI for adding Target Platform. Like elsewhere in Trac web admin, 'New Target Platform' is now a fieldset to the right of the listing. This fixes the issue discussed on #333.
osimons
parents: 572
diff changeset
127 platform = self._create_platform(req, config_name)
5d396356bf7a 0.6dev: Reworked UI for adding Target Platform. Like elsewhere in Trac web admin, 'New Target Platform' is now a fieldset to the right of the listing. This fixes the issue discussed on #333.
osimons
parents: 572
diff changeset
128 req.redirect(req.abs_href.admin(cat, page,
5d396356bf7a 0.6dev: Reworked UI for adding Target Platform. Like elsewhere in Trac web admin, 'New Target Platform' is now a fieldset to the right of the listing. This fixes the issue discussed on #333.
osimons
parents: 572
diff changeset
129 config_name, platform.id))
435
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
130
467
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
131 # Set up template variables
435
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
132 data['platform'] = {
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
133 'id': platform.id, 'name': platform.name,
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
134 'exists': platform.exists,
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
135 'rules': [
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
136 {'property': propname, 'pattern': pattern}
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
137 for propname, pattern in platform.rules
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
138 ] or [('', '')]
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
139 }
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
140
467
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
141 else: # Editing existing build config itself
435
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
142 config = BuildConfig.fetch(self.env, config_name)
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
143 platforms = list(TargetPlatform.select(self.env,
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
144 config=config.name))
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
145
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
146 if req.method == 'POST':
607
5d396356bf7a 0.6dev: Reworked UI for adding Target Platform. Like elsewhere in Trac web admin, 'New Target Platform' is now a fieldset to the right of the listing. This fixes the issue discussed on #333.
osimons
parents: 572
diff changeset
147 if 'remove' in req.args: # Remove selected platforms
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
148 self._remove_platforms(req)
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
149 req.redirect(req.abs_href.admin(cat, page, config.name))
468
44c2b4ac6157 Add stabilization time parameter to build master. Closes #189. Many thanks to Allen Bierbaum for the patch.
cmlenz
parents: 467
diff changeset
150
467
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
151 elif 'save' in req.args: # Save this build config
435
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
152 self._update_config(req, config)
468
44c2b4ac6157 Add stabilization time parameter to build master. Closes #189. Many thanks to Allen Bierbaum for the patch.
cmlenz
parents: 467
diff changeset
153
435
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
154 req.redirect(req.abs_href.admin(cat, page))
468
44c2b4ac6157 Add stabilization time parameter to build master. Closes #189. Many thanks to Allen Bierbaum for the patch.
cmlenz
parents: 467
diff changeset
155
467
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
156 # Prepare template variables
435
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
157 data['config'] = {
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
158 'name': config.name, 'label': config.label or config.name,
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
159 'active': config.active, 'path': config.path,
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
160 'min_rev': config.min_rev, 'max_rev': config.max_rev,
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
161 'description': config.description,
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
162 'recipe': config.recipe,
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
163 'platforms': [{
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
164 'name': platform.name,
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
165 'id': platform.id,
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
166 'href': req.href.admin('bitten', 'configs', config.name,
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
167 platform.id),
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
168 'rules': [{'property': propname, 'pattern': pattern}
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
169 for propname, pattern in platform.rules]
435
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
170 } for platform in platforms]
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
171 }
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
172
467
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
173 else: # At the top level build config list
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
174 if req.method == 'POST':
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
175 if 'add' in req.args: # Add build config
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
176 config = self._create_config(req)
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
177 req.redirect(req.abs_href.admin(cat, page, config.name))
467
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
178
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
179 elif 'remove' in req.args: # Remove selected build configs
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
180 self._remove_configs(req)
467
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
181
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
182 elif 'apply' in req.args: # Update active state of configs
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
183 self._activate_configs(req)
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
184 req.redirect(req.abs_href.admin(cat, page))
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
185
467
5c9f34b18236 Apply patch that clarifies some code in the admin module. Closes #196. Thanks to David Abrahams.
cmlenz
parents: 455
diff changeset
186 # Prepare template variables
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
187 configs = []
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
188 for config in BuildConfig.select(self.env, include_inactive=True):
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
189 configs.append({
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
190 'name': config.name, 'label': config.label or config.name,
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
191 'active': config.active, 'path': config.path,
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
192 'min_rev': config.min_rev, 'max_rev': config.max_rev,
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
193 'href': req.href.admin('bitten', 'configs', config.name),
572
1caaefd76375 0.6dev: Don't provide option to enable a build configuration without a recipe. Closes #168.
osimons
parents: 563
diff changeset
194 'recipe': config.recipe and True or False
429
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
195 })
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
196 data['configs'] = configs
d6e1a05f32f7 Start webadmin integration.
cmlenz
parents:
diff changeset
197
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
198 add_stylesheet(req, 'bitten/admin.css')
563
a5a7e19399b5 Autocomplete path names in configuration using trac's autocompletion code (supports trac 0.11 and 0.12) (Emannuel Blot) - fixes #363
dfraser
parents: 557
diff changeset
199 add_script(req, 'common/js/suggest.js')
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 468
diff changeset
200 return 'bitten_admin_configs.html', data
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
201
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
202 # Internal methods
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
203
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
204 def _activate_configs(self, req):
434
ca0fded18882 Fixes and more tests for the admin panels.
cmlenz
parents: 433
diff changeset
205 req.perm.assert_permission('BUILD_MODIFY')
ca0fded18882 Fixes and more tests for the admin panels.
cmlenz
parents: 433
diff changeset
206
455
dc2c565600a9 Fix for deactivating all configurations on admin page. Closes #175.
cmlenz
parents: 436
diff changeset
207 active = req.args.get('active') or []
dc2c565600a9 Fix for deactivating all configurations on admin page. Closes #175.
cmlenz
parents: 436
diff changeset
208 active = isinstance(active, list) and active or [active]
434
ca0fded18882 Fixes and more tests for the admin panels.
cmlenz
parents: 433
diff changeset
209
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
210 db = self.env.get_db_cnx()
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
211 for config in list(BuildConfig.select(self.env, db=db,
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
212 include_inactive=True)):
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
213 config.active = config.name in active
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
214 config.update(db=db)
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
215 db.commit()
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
216
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
217 def _create_config(self, req):
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
218 req.perm.assert_permission('BUILD_CREATE')
434
ca0fded18882 Fixes and more tests for the admin panels.
cmlenz
parents: 433
diff changeset
219
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
220 config = BuildConfig(self.env)
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
221 self._update_config(req, config)
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
222 return config
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
223
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
224 def _remove_configs(self, req):
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
225 req.perm.assert_permission('BUILD_DELETE')
435
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
226
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
227 sel = req.args.get('sel')
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
228 if not sel:
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
229 raise TracError('No configuration selected')
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
230 sel = isinstance(sel, list) and sel or [sel]
435
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
231
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
232 db = self.env.get_db_cnx()
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
233 for name in sel:
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
234 config = BuildConfig.fetch(self.env, name, db=db)
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
235 if not config:
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
236 raise TracError('Configuration %r not found' % name)
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
237 config.delete(db=db)
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
238 db.commit()
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
239
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
240 def _update_config(self, req, config):
434
ca0fded18882 Fixes and more tests for the admin panels.
cmlenz
parents: 433
diff changeset
241 req.perm.assert_permission('BUILD_MODIFY')
ca0fded18882 Fixes and more tests for the admin panels.
cmlenz
parents: 433
diff changeset
242
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
243 name = req.args.get('name')
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
244 if not name:
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
245 raise TracError('Missing required field "name"', 'Missing Field')
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
246 if not re.match(r'^[\w.-]+$', name):
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
247 raise TracError('The field "name" may only contain letters, '
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
248 'digits, periods, or dashes.', 'Invalid Field')
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
249
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
250 path = req.args.get('path', '')
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
251 repos = self.env.get_repository(req.authname)
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
252 max_rev = req.args.get('max_rev') or None
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
253 try:
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
254 node = repos.get_node(path, max_rev)
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
255 assert node.isdir, '%s is not a directory' % node.path
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
256 except (AssertionError, TracError), e:
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
257 raise TracError(unicode(e), 'Invalid Repository Path')
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
258 if req.args.get('min_rev'):
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
259 try:
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
260 repos.get_node(path, req.args.get('min_rev'))
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
261 except TracError, e:
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
262 raise TracError(unicode(e), 'Invalid Oldest Revision')
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
263
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
264 recipe_xml = req.args.get('recipe', '')
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
265 if recipe_xml:
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
266 try:
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
267 Recipe(xmlio.parse(recipe_xml)).validate()
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
268 except xmlio.ParseError, e:
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
269 raise TracError('Failure parsing recipe: %s' % e,
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
270 'Invalid Recipe')
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
271 except InvalidRecipeError, e:
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
272 raise TracError(unicode(e), 'Invalid Recipe')
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
273
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
274 config.name = name
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
275 config.path = repos.normalize_path(path)
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
276 config.recipe = recipe_xml
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
277 config.min_rev = req.args.get('min_rev')
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
278 config.max_rev = req.args.get('max_rev')
435
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
279 config.label = req.args.get('label', config.name)
433
201f467e0ec1 More unit tests for admin module.
cmlenz
parents: 432
diff changeset
280 config.description = req.args.get('description', '')
435
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
281
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
282 if config.exists:
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
283 config.update()
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
284 else:
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
285 config.insert()
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
286
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
287 def _create_platform(self, req, config_name):
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
288 req.perm.assert_permission('BUILD_MODIFY')
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
289
607
5d396356bf7a 0.6dev: Reworked UI for adding Target Platform. Like elsewhere in Trac web admin, 'New Target Platform' is now a fieldset to the right of the listing. This fixes the issue discussed on #333.
osimons
parents: 572
diff changeset
290 name = req.args.get('platform_name')
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
291 if not name:
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
292 raise TracError('Missing required field "name"', 'Missing field')
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
293
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
294 platform = TargetPlatform(self.env, config=config_name, name=name)
607
5d396356bf7a 0.6dev: Reworked UI for adding Target Platform. Like elsewhere in Trac web admin, 'New Target Platform' is now a fieldset to the right of the listing. This fixes the issue discussed on #333.
osimons
parents: 572
diff changeset
295 platform.insert()
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
296 return platform
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
297
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
298 def _remove_platforms(self, req):
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
299 req.perm.assert_permission('BUILD_MODIFY')
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
300
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
301 sel = req.args.get('sel')
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
302 if not sel:
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
303 raise TracError('No platform selected')
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
304 sel = isinstance(sel, list) and sel or [sel]
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
305
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
306 db = self.env.get_db_cnx()
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
307 for platform_id in sel:
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
308 platform = TargetPlatform.fetch(self.env, platform_id, db=db)
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
309 if not platform:
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
310 raise TracError('Target platform %r not found' % platform_id)
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
311 platform.delete(db=db)
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
312 db.commit()
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
313
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
314 def _update_platform(self, req, platform):
435
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
315 platform.name = req.args.get('name')
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
316
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
317 properties = [int(key[9:]) for key in req.args.keys()
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
318 if key.startswith('property_')]
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
319 properties.sort()
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
320 patterns = [int(key[8:]) for key in req.args.keys()
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
321 if key.startswith('pattern_')]
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
322 patterns.sort()
609
022bcceb90b7 0.6dev: Removing whitespace from target platform rules admin. Fixes #336.
osimons
parents: 607
diff changeset
323 platform.rules = [(req.args.get('property_%d' % property).strip(),
022bcceb90b7 0.6dev: Removing whitespace from target platform rules admin. Fixes #336.
osimons
parents: 607
diff changeset
324 req.args.get('pattern_%d' % pattern).strip())
435
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
325 for property, pattern in zip(properties, patterns)
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
326 if req.args.get('property_%d' % property)]
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
327
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
328 if platform.exists:
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
329 platform.update()
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
330 else:
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
331 platform.insert()
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
332
435
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
333 add_rules = [int(key[9:]) for key in req.args.keys()
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
334 if key.startswith('add_rule_')]
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
335 if add_rules:
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
336 platform.rules.insert(add_rules[0] + 1, ('', ''))
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
337 return False
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
338 rm_rules = [int(key[8:]) for key in req.args.keys()
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
339 if key.startswith('rm_rule_')]
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
340 if rm_rules:
436
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
341 if rm_rules[0] < len(platform.rules):
cfbc9ee622d5 Finish the move of build configuration management into the admin interface.
cmlenz
parents: 435
diff changeset
342 del platform.rules[rm_rules[0]]
435
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
343 return False
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
344
8424a8afd1a1 Started implementing platform editing via admin interface.
cmlenz
parents: 434
diff changeset
345 return True
Copyright (C) 2012-2017 Edgewall Software