Mercurial > farol > farol
diff farol/vulnerability.py @ 60:c6e7175ff28c
Unify acknowledgments update/creation from forms
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Wed, 08 Oct 2014 11:58:33 +0200 |
parents | 64403f1b424e |
children | 55b72057b066 |
line wrap: on
line diff
--- a/farol/vulnerability.py Wed Oct 08 11:38:44 2014 +0200 +++ b/farol/vulnerability.py Wed Oct 08 11:58:33 2014 +0200 @@ -31,7 +31,8 @@ CVRFProductStatus, CVRFCVSSSet, CVRFRemediation) from farolluz.renderer import utcnow -from .controller import update_note_from_request, create_note_from_request +from .controller import (update_note_from_request, create_note_from_request, + update_acknowledgment_from_request, create_acknowledgment_from_request) from .session import document_required, get_current @@ -460,10 +461,7 @@ if request.method != 'POST': return render_template('vulnerability/edit_acknowledgment.j2', ordinal=ordinal, name=ack._name, organization=ack._organization, description=ack._description, url=ack._url, action='Update') - ack._name = request.form['name'] or None - ack._organization = request.form['organization'] or None - ack._description = request.form['description'] or None - ack._url = request.form['url'] or None + update_acknowledgment_from_request(ack) return redirect(url_for('.view', ordinal=ordinal)) @vulnerability.route('/<int:ordinal>/acknowledgment/add', methods=['GET', 'POST']) @@ -472,10 +470,6 @@ if request.method != 'POST': return render_template('vulnerability/edit_acknowledgment.j2', action='Add', ordinal=ordinal) - ack = CVRFAcknowledgment() - ack._name = request.form['name'] or None - ack._organization = request.form['organization'] or None - ack._description = request.form['description'] or None - ack._url = request.form['url'] or None + ack = create_acknowledgment_from_request() get_vuln(ordinal).addAcknowledgment(ack) return redirect(url_for('.view', ordinal=ordinal))