Mercurial > farol > farol
annotate farol/producttree.py @ 86:2d41121ec991
Fix issue when relation are defined
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Thu, 09 Oct 2014 14:50:37 +0200 |
parents | b6a48669edb8 |
children | e02724c84bae |
rev | line source |
---|---|
0 | 1 # -*- encoding: utf-8 -*- |
2 # Description: | |
3 # Web stuff about the ProductTree | |
4 # | |
5 # Authors: | |
6 # BenoƮt Allard <benoit.allard@greenbone.net> | |
7 # | |
8 # Copyright: | |
9 # Copyright (C) 2014 Greenbone Networks GmbH | |
10 # | |
11 # This program is free software; you can redistribute it and/or | |
12 # modify it under the terms of the GNU General Public License | |
13 # as published by the Free Software Foundation; either version 2 | |
14 # of the License, or (at your option) any later version. | |
15 # | |
16 # This program is distributed in the hope that it will be useful, | |
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 # GNU General Public License for more details. | |
20 # | |
21 # You should have received a copy of the GNU General Public License | |
22 # along with this program; if not, write to the Free Software | |
23 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
24 | |
25 """\ | |
26 Web-stuff about the producttree | |
27 """ | |
28 | |
29 from functools import wraps | |
30 | |
31 from flask import Blueprint, render_template, redirect, url_for, abort, request, flash | |
32 | |
33 from farolluz.cvrf import (CVRFProductBranch, CVRFFullProductName, | |
34 CVRFRelationship, CVRFGroup) | |
35 from .session import document_required, get_current | |
36 | |
37 producttree = Blueprint('producttree', __name__) | |
38 | |
39 def producttree_required(f): | |
40 @wraps(f) | |
41 def decorated_function(*args, **kwargs): | |
42 if get_current()._producttree is None: | |
43 flash('Operation invalid without producttree', 'warning') | |
22
dbfe89e3c6fe
Fix producttree urls
Benoît Allard <benoit.allard@greenbone.net>
parents:
0
diff
changeset
|
44 return redirect(url_for('document.view')) |
0 | 45 return f(*args, **kwargs) |
46 return decorated_function | |
47 | |
48 @producttree.route('/create', methods=['POST']) | |
49 @document_required | |
50 def create(): | |
51 get_current().createProductTree() | |
45
7c4d001839e7
Move the Display of the ProductTree to its own page
Benoît Allard <benoit.allard@greenbone.net>
parents:
22
diff
changeset
|
52 return redirect(url_for('.view')) |
0 | 53 |
45
7c4d001839e7
Move the Display of the ProductTree to its own page
Benoît Allard <benoit.allard@greenbone.net>
parents:
22
diff
changeset
|
54 @producttree.route('/') |
7c4d001839e7
Move the Display of the ProductTree to its own page
Benoît Allard <benoit.allard@greenbone.net>
parents:
22
diff
changeset
|
55 @document_required |
7c4d001839e7
Move the Display of the ProductTree to its own page
Benoît Allard <benoit.allard@greenbone.net>
parents:
22
diff
changeset
|
56 @producttree_required |
7c4d001839e7
Move the Display of the ProductTree to its own page
Benoît Allard <benoit.allard@greenbone.net>
parents:
22
diff
changeset
|
57 def view(): |
86
2d41121ec991
Fix issue when relation are defined
Benoît Allard <benoit.allard@greenbone.net>
parents:
85
diff
changeset
|
58 cvrf = get_current() |
45
7c4d001839e7
Move the Display of the ProductTree to its own page
Benoît Allard <benoit.allard@greenbone.net>
parents:
22
diff
changeset
|
59 return render_template('producttree/view.j2', |
86
2d41121ec991
Fix issue when relation are defined
Benoît Allard <benoit.allard@greenbone.net>
parents:
85
diff
changeset
|
60 producttree=cvrf._producttree, cvrf=cvrf) |
0 | 61 |
62 @producttree.route('/branch/<path:path>/edit', methods=['GET', 'POST']) | |
63 @document_required | |
64 @producttree_required | |
65 def edit_branch(path): | |
66 path = [int(p) for p in path.split('/')] | |
67 cvrf = get_current() | |
68 ptree = cvrf._producttree | |
78
264d4579f6bf
More input validation
Benoît Allard <benoit.allard@greenbone.net>
parents:
62
diff
changeset
|
69 try: branch = cvrf._producttree.getBranch(path) |
264d4579f6bf
More input validation
Benoît Allard <benoit.allard@greenbone.net>
parents:
62
diff
changeset
|
70 except (ValueError, IndexError): abort(404) |
0 | 71 if request.method != 'POST': |
72 branches = [('', '')] + [(b.getName(), b.getPath(True)) for b in ptree.getNotTerminalBranches(branch)] | |
85
b6a48669edb8
Don't create a branch only to have empty name
Benoît Allard <benoit.allard@greenbone.net>
parents:
84
diff
changeset
|
73 return render_template('producttree/edit_branch.j2', |
b6a48669edb8
Don't create a branch only to have empty name
Benoît Allard <benoit.allard@greenbone.net>
parents:
84
diff
changeset
|
74 _type=branch._type, name=branch._name, parentpath=branch.getParentPath(), |
b6a48669edb8
Don't create a branch only to have empty name
Benoît Allard <benoit.allard@greenbone.net>
parents:
84
diff
changeset
|
75 branches=branches, types=branch.TYPES) |
0 | 76 |
77 pbranch = ptree | |
78 if request.form['parent']: | |
78
264d4579f6bf
More input validation
Benoît Allard <benoit.allard@greenbone.net>
parents:
62
diff
changeset
|
79 try: pbranch = ptree.getBranch([int(p) for p in request.form['parent'].split('/')]) |
264d4579f6bf
More input validation
Benoît Allard <benoit.allard@greenbone.net>
parents:
62
diff
changeset
|
80 except (ValueError, IndexError): abort(404) |
0 | 81 |
82 if pbranch is not branch.getParent(): | |
83 # We have to 're-link' the element ... | |
84 # 1. unlink | |
85 branch.unlink() | |
86 # 2. set the new parent | |
82
d6fa288e92a7
Update to latest farolluz (unlink/link)
Benoît Allard <benoit.allard@greenbone.net>
parents:
80
diff
changeset
|
87 branch.link(pbranch) |
0 | 88 |
89 branch._type = request.form['type'] | |
90 branch._name = request.form['name'] | |
45
7c4d001839e7
Move the Display of the ProductTree to its own page
Benoît Allard <benoit.allard@greenbone.net>
parents:
22
diff
changeset
|
91 return redirect(url_for('.view')) |
0 | 92 |
93 @producttree.route('/branch/add', methods=['GET', 'POST']) | |
94 @document_required | |
95 @producttree_required | |
96 def add_branch(): | |
97 cvrf = get_current() | |
98 ptree = cvrf._producttree | |
99 if request.method != 'POST': | |
100 branches = [('', '')] + [(b.getName(), b.getPath(True)) for b in ptree.getNotTerminalBranches()] | |
85
b6a48669edb8
Don't create a branch only to have empty name
Benoît Allard <benoit.allard@greenbone.net>
parents:
84
diff
changeset
|
101 return render_template('producttree/edit_branch.j2', |
b6a48669edb8
Don't create a branch only to have empty name
Benoît Allard <benoit.allard@greenbone.net>
parents:
84
diff
changeset
|
102 action='Add', |
b6a48669edb8
Don't create a branch only to have empty name
Benoît Allard <benoit.allard@greenbone.net>
parents:
84
diff
changeset
|
103 branches=branches, types=CVRFProductBranch.TYPES) |
0 | 104 |
105 pbranch = ptree | |
106 if request.form['parent']: | |
78
264d4579f6bf
More input validation
Benoît Allard <benoit.allard@greenbone.net>
parents:
62
diff
changeset
|
107 try: pbranch = ptree.getBranch([int(p) for p in request.form['parent'].split('/')]) |
264d4579f6bf
More input validation
Benoît Allard <benoit.allard@greenbone.net>
parents:
62
diff
changeset
|
108 except (ValueError, IndexError): abort(404) |
0 | 109 branch = CVRFProductBranch(request.form['type'], request.form['name'], pbranch) |
45
7c4d001839e7
Move the Display of the ProductTree to its own page
Benoît Allard <benoit.allard@greenbone.net>
parents:
22
diff
changeset
|
110 return redirect(url_for('.view')) |
0 | 111 |
80
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
112 @producttree.route('/branch/<path:path>/del', methods=['POST']) |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
113 @document_required |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
114 @producttree_required |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
115 def del_branch(path): |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
116 path = [int(p) for p in path.split('/')] |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
117 cvrf = get_current() |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
118 ptree = cvrf._producttree |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
119 try: branch = cvrf._producttree.getBranch(path) |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
120 except (ValueError, IndexError): |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
121 flash('Cannot find Branch', 'danger') |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
122 abort(404) |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
123 if branch._childs: |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
124 flash('Cannot delete a branch with childs', 'danger') |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
125 abort(403) |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
126 branch.unlink() |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
127 del branch |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
128 return redirect(url_for('.view')) |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
129 |
c00f20bd90ba
Allow deletion of (orphaned) Branches
Benoît Allard <benoit.allard@greenbone.net>
parents:
78
diff
changeset
|
130 |
0 | 131 @producttree.route('/product/<productid>') |
132 @document_required | |
133 @producttree_required | |
134 def view_product(productid): | |
135 cvrf = get_current() | |
136 try: | |
137 product = cvrf.getProductForID(productid) | |
138 except IndexError: | |
139 abort(404) | |
140 return render_template('producttree/view_product.j2', product=product, cvrf=cvrf) | |
141 | |
142 @producttree.route('/product/<productid>/edit', methods=['GET', 'POST']) | |
143 @document_required | |
144 @producttree_required | |
145 def edit_product(productid): | |
146 cvrf = get_current() | |
147 ptree = cvrf._producttree | |
148 try: | |
149 product = cvrf.getProductForID(productid) | |
150 except KeyError: | |
151 abort(404) | |
152 | |
153 if request.method != 'POST': | |
154 current_rel = '' | |
155 if product.isRelationship(): | |
156 current_rel = str(ptree._relationships.index(product.getCurrentRelationship())) | |
157 leaves = [('', '')] + [(b.getName(), b.getPath(True)) for b in ptree.getOrphanedBranches(product)] | |
158 rels = [('', '')] + [(ptree.getNameOfRelationship(r), str(i)) for i, r in ptree.getOrphanedRelationships(product)] | |
159 return render_template('producttree/edit_product.j2', product=product, action='Update', orphaned_leaves=leaves, orphaned_relationships=rels, current_rel=current_rel) | |
160 | |
161 if request.form['parent_branch'] and request.form['parent_relationship']: | |
162 flash('Cannot set a parent branch and parent relationship', 'danger') | |
163 return redirect(url_for('.edit_product', productid=productid)) | |
164 | |
165 oldp = product._parent | |
166 if request.form['parent_branch']: | |
78
264d4579f6bf
More input validation
Benoît Allard <benoit.allard@greenbone.net>
parents:
62
diff
changeset
|
167 try: pbranch = ptree.getBranch([int(p) for p in request.form['parent_branch'].split('/')]) |
264d4579f6bf
More input validation
Benoît Allard <benoit.allard@greenbone.net>
parents:
62
diff
changeset
|
168 except (ValueError, IndexError): abort(404) |
0 | 169 if pbranch is not oldp: |
170 # Gonna be funny, needs re-link | |
171 product.unlink() | |
82
d6fa288e92a7
Update to latest farolluz (unlink/link)
Benoît Allard <benoit.allard@greenbone.net>
parents:
80
diff
changeset
|
172 # And Link again |
d6fa288e92a7
Update to latest farolluz (unlink/link)
Benoît Allard <benoit.allard@greenbone.net>
parents:
80
diff
changeset
|
173 product.link(pbranch) |
0 | 174 elif request.form['parent_relationship']: |
175 prel = ptree._relationships[int(request.form['parent_relationship'])] | |
176 if prel is not oldp: | |
82
d6fa288e92a7
Update to latest farolluz (unlink/link)
Benoît Allard <benoit.allard@greenbone.net>
parents:
80
diff
changeset
|
177 # Unlink |
0 | 178 product.unlink() |
82
d6fa288e92a7
Update to latest farolluz (unlink/link)
Benoît Allard <benoit.allard@greenbone.net>
parents:
80
diff
changeset
|
179 # Link again |
d6fa288e92a7
Update to latest farolluz (unlink/link)
Benoît Allard <benoit.allard@greenbone.net>
parents:
80
diff
changeset
|
180 product.link(prel) |
0 | 181 else: |
182 if ptree is not oldp: | |
82
d6fa288e92a7
Update to latest farolluz (unlink/link)
Benoît Allard <benoit.allard@greenbone.net>
parents:
80
diff
changeset
|
183 # Unlink |
0 | 184 product.unlink() |
82
d6fa288e92a7
Update to latest farolluz (unlink/link)
Benoît Allard <benoit.allard@greenbone.net>
parents:
80
diff
changeset
|
185 # Link again |
d6fa288e92a7
Update to latest farolluz (unlink/link)
Benoît Allard <benoit.allard@greenbone.net>
parents:
80
diff
changeset
|
186 product.link(ptree) |
0 | 187 |
188 product._productid = request.form['productid'] | |
189 product._name = request.form['name'] | |
190 product._cpe = request.form['cpe'] or None | |
45
7c4d001839e7
Move the Display of the ProductTree to its own page
Benoît Allard <benoit.allard@greenbone.net>
parents:
22
diff
changeset
|
191 return redirect(url_for('.view')) |
0 | 192 |
193 @producttree.route('/product/add', methods=['GET', 'POST']) | |
194 @document_required | |
195 @producttree_required | |
196 def add_product(): | |
197 cvrf = get_current() | |
198 ptree = cvrf._producttree | |
199 | |
200 if request.method != 'POST': | |
201 product=CVRFFullProductName('', '', ptree) | |
202 leaves = [('', '')] + [(b.getName(), b.getPath(True)) for b in ptree.getOrphanedBranches()] | |
203 rels = [('', '')] + [(ptree.getNameOfRelationship(r), str(i)) for i, r in ptree.getOrphanedRelationships()] | |
204 return render_template('producttree/edit_product.j2', product=product, action='Add', orphaned_leaves=leaves, orphaned_relationships=rels, current_rel='') | |
205 | |
206 if request.form['parent_branch'] and request.form['parent_relationship']: | |
207 flash('Cannot set a parent branch and parent relationship', 'danger') | |
62
ce49bd1512dd
Make pyflafes a happier
Benoît Allard <benoit.allard@greenbone.net>
parents:
45
diff
changeset
|
208 return redirect(url_for('.add_product')) |
0 | 209 |
210 parent = ptree | |
211 if request.form['parent_branch']: | |
83
2ecf13200e87
Fix issue from a previous commit
Benoît Allard <benoit.allard@greenbone.net>
parents:
82
diff
changeset
|
212 try: parent = ptree.getBranch([int(p) for p in request.form['parent_branch'].split('/')]) |
78
264d4579f6bf
More input validation
Benoît Allard <benoit.allard@greenbone.net>
parents:
62
diff
changeset
|
213 except (ValueError, IndexError): abort(404) |
0 | 214 elif request.form['parent_relationship']: |
215 parent = ptree._relationships[int(request.form['parent_relationship'])] | |
216 | |
217 product = CVRFFullProductName(request.form['productid'], request.form['name'], parent, request.form['cpe'] or None) | |
218 ptree.addProduct(product) | |
45
7c4d001839e7
Move the Display of the ProductTree to its own page
Benoît Allard <benoit.allard@greenbone.net>
parents:
22
diff
changeset
|
219 return redirect(url_for('.view')) |
0 | 220 |
84
cc836f9e869e
Allow deletion of Products
Benoît Allard <benoit.allard@greenbone.net>
parents:
83
diff
changeset
|
221 @producttree.route('/product/<productid>/del', methods=['POST']) |
cc836f9e869e
Allow deletion of Products
Benoît Allard <benoit.allard@greenbone.net>
parents:
83
diff
changeset
|
222 @document_required |
cc836f9e869e
Allow deletion of Products
Benoît Allard <benoit.allard@greenbone.net>
parents:
83
diff
changeset
|
223 @producttree_required |
cc836f9e869e
Allow deletion of Products
Benoît Allard <benoit.allard@greenbone.net>
parents:
83
diff
changeset
|
224 def del_product(productid): |
cc836f9e869e
Allow deletion of Products
Benoît Allard <benoit.allard@greenbone.net>
parents:
83
diff
changeset
|
225 cvrf = get_current() |
cc836f9e869e
Allow deletion of Products
Benoît Allard <benoit.allard@greenbone.net>
parents:
83
diff
changeset
|
226 ptree = cvrf._producttree |
cc836f9e869e
Allow deletion of Products
Benoît Allard <benoit.allard@greenbone.net>
parents:
83
diff
changeset
|
227 try: |
cc836f9e869e
Allow deletion of Products
Benoît Allard <benoit.allard@greenbone.net>
parents:
83
diff
changeset
|
228 product = cvrf.getProductForID(productid) |
cc836f9e869e
Allow deletion of Products
Benoît Allard <benoit.allard@greenbone.net>
parents:
83
diff
changeset
|
229 except KeyError: |
cc836f9e869e
Allow deletion of Products
Benoît Allard <benoit.allard@greenbone.net>
parents:
83
diff
changeset
|
230 abort(404) |
cc836f9e869e
Allow deletion of Products
Benoît Allard <benoit.allard@greenbone.net>
parents:
83
diff
changeset
|
231 product.unlink() |
cc836f9e869e
Allow deletion of Products
Benoît Allard <benoit.allard@greenbone.net>
parents:
83
diff
changeset
|
232 ptree._products.remove(product) |
cc836f9e869e
Allow deletion of Products
Benoît Allard <benoit.allard@greenbone.net>
parents:
83
diff
changeset
|
233 del product |
cc836f9e869e
Allow deletion of Products
Benoît Allard <benoit.allard@greenbone.net>
parents:
83
diff
changeset
|
234 return redirect(url_for('.view')) |
cc836f9e869e
Allow deletion of Products
Benoît Allard <benoit.allard@greenbone.net>
parents:
83
diff
changeset
|
235 |
cc836f9e869e
Allow deletion of Products
Benoît Allard <benoit.allard@greenbone.net>
parents:
83
diff
changeset
|
236 |
0 | 237 @producttree.route('/relationship/<int:index>/edit', methods=['GET', 'POST']) |
238 @document_required | |
239 @producttree_required | |
240 def edit_relationship(index): | |
241 cvrf = get_current() | |
242 ptree = cvrf._producttree | |
243 try: | |
244 rel = ptree._relationships[index] | |
245 except IndexError: | |
246 abort(404) | |
247 | |
248 if request.method != 'POST': | |
249 return render_template('producttree/edit_relationship.j2', productreference=rel._productreference, relationtype=rel._relationtype, relatestoproductreference=rel._relatestoproductreference, types=rel.TYPES) | |
250 | |
251 rel._productreference = request.form['productreference'] | |
252 rel._relationtype = request.form['relationtype'] | |
253 rel._relatestoproductreference = request.form['relatestoproductreference'] | |
45
7c4d001839e7
Move the Display of the ProductTree to its own page
Benoît Allard <benoit.allard@greenbone.net>
parents:
22
diff
changeset
|
254 return redirect(url_for('.view')) |
0 | 255 |
256 @producttree.route('/relationship/add', methods=['GET', 'POST']) | |
257 @document_required | |
258 @producttree_required | |
259 def add_relationship(): | |
260 cvrf = get_current() | |
261 ptree = cvrf._producttree | |
262 if len(ptree._products) < 2: | |
263 flash('You need to have at least two products to create a relationship', 'warning') | |
264 return redirect(url_for('.add_product')) | |
265 | |
266 if request.method != 'POST': | |
267 return render_template('producttree/edit_relationship.j2', action='Add', types=CVRFRelationship.TYPES) | |
268 | |
269 prodid1 = request.form['productreference'] | |
270 prodid2 = request.form['relatestoproductreference'] | |
271 | |
272 if prodid1 == prodid2: | |
273 flash('You cannot create a relationship with the same product twice', 'danger') | |
274 return redirect(url_for('.add_relationship')) | |
275 | |
276 rel = CVRFRelationship(prodid1, request.form['relationtype'], prodid2) | |
277 ptree.addRelationship(rel) | |
45
7c4d001839e7
Move the Display of the ProductTree to its own page
Benoît Allard <benoit.allard@greenbone.net>
parents:
22
diff
changeset
|
278 return redirect(url_for('.view')) |
0 | 279 |
280 @producttree.route('/group/<groupid>/edit', methods=['GET', 'POST']) | |
281 @document_required | |
282 @producttree_required | |
283 def edit_group(groupid): | |
284 try: | |
285 group = get_current().getGroupForID(groupid) | |
286 except KeyError: | |
287 abort(404) | |
288 if request.method != 'POST': | |
289 return render_template('producttree/edit_group.j2', groupid=group._groupid, description=group._description, productids=group._productids) | |
290 | |
291 group._groupid = request.form['groupid'] | |
292 group.setDescription(request.form['description'] or None) | |
293 group._productids = [] | |
294 for productid in request.form.getlist('products'): | |
295 group.addProductID(productid) | |
45
7c4d001839e7
Move the Display of the ProductTree to its own page
Benoît Allard <benoit.allard@greenbone.net>
parents:
22
diff
changeset
|
296 return redirect(url_for('.view')) |
0 | 297 |
298 @producttree.route('/group/add', methods=['GET', 'POST']) | |
299 @document_required | |
300 @producttree_required | |
301 def add_group(): | |
302 if request.method != 'POST': | |
303 return render_template('producttree/edit_group.j2', action='Add') | |
304 | |
305 group = CVRFGroup(request.form['groupid']) | |
306 group.setDescription(request.form['description'] or None) | |
307 for productid in request.form.getlist('products'): | |
308 group.addProductID(productid) | |
309 get_current()._producttree.addGroup(group) | |
45
7c4d001839e7
Move the Display of the ProductTree to its own page
Benoît Allard <benoit.allard@greenbone.net>
parents:
22
diff
changeset
|
310 return redirect(url_for('.view')) |