Mercurial > farol
changeset 139:584587a000a2
Propagate ProductID and GroupID updates in the whole document
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Mon, 27 Oct 2014 15:08:29 +0100 |
parents | 43cd11ba7928 |
children | 3a56d5501ffa |
files | farol/producttree.py |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/farol/producttree.py Mon Oct 27 11:22:59 2014 +0100 +++ b/farol/producttree.py Mon Oct 27 15:08:29 2014 +0100 @@ -196,6 +196,9 @@ # Link again product.link(ptree) + if (request.form['productid'] != product._productid) and not cvrf.isProductOrphan(product._productid): + flash('Also updating the ProductID for %s in this Document' % request.form['name'], 'info') + cvrf.changeProductID(product._productid, request.form['productid']) product._productid = request.form['productid'] product._name = request.form['name'] product._cpe = request.form['cpe'] or None @@ -313,13 +316,17 @@ @document_required @producttree_required def edit_group(groupid): + cvrf = get_current() try: - group = get_current().getGroupForID(groupid) + group = cvrf.getGroupForID(groupid) except KeyError: abort(404) if request.method != 'POST': return render_template('producttree/edit_group.j2', groupid=group._groupid, description=group._description, productids=group._productids) + if (request.form['groupid'] != group._groupid) and not cvrf.isGroupOrphan(group._groupid): + flash('Also updating the groupid in the whole document.', 'info') + cvrf.changeGroupID(group._groupid, request.form['groupid']) group._groupid = request.form['groupid'] group.setDescription(request.form['description'] or None) group._productids = []