Mercurial > farol > farol
comparison farol/producttree.py @ 84:cc836f9e869e
Allow deletion of Products
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Thu, 09 Oct 2014 14:26:59 +0200 |
parents | 2ecf13200e87 |
children | b6a48669edb8 |
comparison
equal
deleted
inserted
replaced
83:2ecf13200e87 | 84:cc836f9e869e |
---|---|
211 | 211 |
212 product = CVRFFullProductName(request.form['productid'], request.form['name'], parent, request.form['cpe'] or None) | 212 product = CVRFFullProductName(request.form['productid'], request.form['name'], parent, request.form['cpe'] or None) |
213 ptree.addProduct(product) | 213 ptree.addProduct(product) |
214 return redirect(url_for('.view')) | 214 return redirect(url_for('.view')) |
215 | 215 |
216 @producttree.route('/product/<productid>/del', methods=['POST']) | |
217 @document_required | |
218 @producttree_required | |
219 def del_product(productid): | |
220 cvrf = get_current() | |
221 ptree = cvrf._producttree | |
222 try: | |
223 product = cvrf.getProductForID(productid) | |
224 except KeyError: | |
225 abort(404) | |
226 product.unlink() | |
227 ptree._products.remove(product) | |
228 del product | |
229 return redirect(url_for('.view')) | |
230 | |
231 | |
216 @producttree.route('/relationship/<int:index>/edit', methods=['GET', 'POST']) | 232 @producttree.route('/relationship/<int:index>/edit', methods=['GET', 'POST']) |
217 @document_required | 233 @document_required |
218 @producttree_required | 234 @producttree_required |
219 def edit_relationship(index): | 235 def edit_relationship(index): |
220 cvrf = get_current() | 236 cvrf = get_current() |