Mercurial > farol > farol
annotate farol/document.py @ 68:33cdb9faed64
Improve deletion of revisions (input validation)
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Thu, 09 Oct 2014 10:10:48 +0200 |
parents | 023080ffd995 |
children | 727c01e8e3e9 |
rev | line source |
---|---|
0 | 1 # -*- encoding: utf-8 -*- |
2 # Description: | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
3 # The Document Blueprint |
0 | 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 | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
25 from flask import (Blueprint, render_template, abort, redirect, request, |
66
f1705e90695b
Don't allow to add a revision without tracking information
Benoît Allard <benoit.allard@greenbone.net>
parents:
64
diff
changeset
|
26 url_for, flash) |
0 | 27 |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
28 from farolluz.parsers.cvrf import parseDate, parseVersion |
62
ce49bd1512dd
Make pyflafes a happier
Benoît Allard <benoit.allard@greenbone.net>
parents:
61
diff
changeset
|
29 from farolluz.cvrf import (CVRFNote, CVRFReference, CVRFPublisher, |
ce49bd1512dd
Make pyflafes a happier
Benoît Allard <benoit.allard@greenbone.net>
parents:
61
diff
changeset
|
30 CVRFTracking, CVRFTrackingID, CVRFGenerator, CVRFRevision, |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
31 CVRFAggregateSeverity) |
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
32 from farolluz.renderer import utcnow |
0 | 33 |
60
c6e7175ff28c
Unify acknowledgments update/creation from forms
Benoît Allard <benoit.allard@greenbone.net>
parents:
58
diff
changeset
|
34 from .controller import (update_note_from_request, create_note_from_request, |
61
55b72057b066
Unify reference update/creation from forms
Benoît Allard <benoit.allard@greenbone.net>
parents:
60
diff
changeset
|
35 update_reference_from_request, create_reference_from_request, |
63
b4fb652484b4
Define a split_fields function to split fields, and use it
Benoît Allard <benoit.allard@greenbone.net>
parents:
62
diff
changeset
|
36 update_acknowledgment_from_request, create_acknowledgment_from_request, |
b4fb652484b4
Define a split_fields function to split fields, and use it
Benoît Allard <benoit.allard@greenbone.net>
parents:
62
diff
changeset
|
37 split_fields) |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
38 from .session import document_required, get_current |
0 | 39 |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
40 |
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
41 document = Blueprint('document', __name__) |
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
42 |
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
43 @document.route('/') |
0 | 44 @document_required |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
45 def view(): |
0 | 46 cvrf = get_current() |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
47 return render_template('document/view.j2', cvrf=cvrf) |
0 | 48 |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
49 @document.route('/title/edit', methods=['GET', 'POST']) |
0 | 50 @document_required |
51 def edit_title(): | |
52 if request.method != 'POST': | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
53 return render_template('document/edit_title.j2', title = get_current()._title, _type = get_current()._type) |
0 | 54 |
55 | |
56 get_current()._title = request.form['title'] | |
57 get_current()._type = request.form['type'] | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
58 return redirect(url_for('.view')) |
0 | 59 |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
60 @document.route('/publisher/edit', methods=['GET', 'POST']) |
0 | 61 @document_required |
62 def edit_publisher(): | |
63 if request.method != 'POST': | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
64 return render_template('document/edit_publisher.j2', publisher = get_current()._publisher or CVRFPublisher(''), types=CVRFPublisher.TYPES) |
0 | 65 |
66 publisher = CVRFPublisher(request.form['type'], request.form['vendorid'] or None) | |
67 publisher.setContact(request.form['contact'] or None) | |
68 publisher.setAuthority(request.form['authority'] or None) | |
69 get_current().setPublisher(publisher) | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
70 return redirect(url_for('.view')) |
0 | 71 |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
72 @document.route('/tracking/edit', methods=['GET', 'POST']) |
0 | 73 @document_required |
74 def edit_tracking(): | |
75 wasNone = False | |
76 tracking = get_current()._tracking | |
77 if tracking is None: | |
78 wasNone = True | |
66
f1705e90695b
Don't allow to add a revision without tracking information
Benoît Allard <benoit.allard@greenbone.net>
parents:
64
diff
changeset
|
79 tracking = CVRFTracking(CVRFTrackingID(''), 'Draft', (0,0), utcnow(), utcnow()) |
0 | 80 generator = tracking._generator |
81 if not tracking._generator: | |
82 generator = CVRFGenerator() | |
83 if request.method != 'POST': | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
84 return render_template('document/edit_tracking.j2', tracking=tracking, version='.'.join('%s'%v for v in tracking._version), generator=generator, now=utcnow(), statuses=tracking.STATUSES) |
0 | 85 |
86 tracking._identification._id = request.form['id'] | |
63
b4fb652484b4
Define a split_fields function to split fields, and use it
Benoît Allard <benoit.allard@greenbone.net>
parents:
62
diff
changeset
|
87 aliases = split_fields(request.form['id_aliases']) |
0 | 88 tracking._identification._aliases = aliases |
89 tracking._status = request.form['status'] | |
90 tracking._version = parseVersion(request.form['version']) | |
91 tracking._initialDate = parseDate(request.form['initial']) | |
92 tracking._currentDate = parseDate(request.form['current']) | |
93 if wasNone: | |
94 get_current().setTracking(tracking) | |
95 if (not request.form['gen_engine']) and (not request.form['gen_date']): | |
96 generator = None | |
97 else: | |
98 generator._engine = request.form['gen_engine'] or None | |
99 if request.form['gen_date']: | |
100 generator._date = parseDate(request.form['gen_date']) | |
101 else: | |
102 generator._date = None | |
103 tracking.setGenerator(generator) | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
104 return redirect(url_for('.view')) |
0 | 105 |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
106 @document.route('/revision/<int:index>/edit', methods=['GET', 'POST']) |
0 | 107 @document_required |
108 def edit_revision(index): | |
109 cvrf = get_current() | |
110 if cvrf._tracking is None: | |
111 abort(404) | |
112 try: | |
113 revision = cvrf._tracking._history[index] | |
114 except IndexError: | |
115 abort(404) | |
116 if request.method != 'POST': | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
117 return render_template('document/edit_revision.j2', number='.'.join('%s'%v for v in revision._number), date=revision._date, description=revision._description, action='Update') |
0 | 118 |
119 revision._number = parseVersion(request.form['number']) | |
120 revision._date = parseDate(request.form['date']) | |
121 revision._description = request.form['description'] | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
122 return redirect(url_for('.view')) |
0 | 123 |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
124 @document.route('/revision/add', methods=['GET', 'POST']) |
0 | 125 @document_required |
126 def add_revision(): | |
127 tracking = get_current()._tracking | |
128 if request.method != 'POST': | |
66
f1705e90695b
Don't allow to add a revision without tracking information
Benoît Allard <benoit.allard@greenbone.net>
parents:
64
diff
changeset
|
129 if tracking is None: |
f1705e90695b
Don't allow to add a revision without tracking information
Benoît Allard <benoit.allard@greenbone.net>
parents:
64
diff
changeset
|
130 flash('The tracking information should be set first to be able to add a revision.', 'danger') |
f1705e90695b
Don't allow to add a revision without tracking information
Benoît Allard <benoit.allard@greenbone.net>
parents:
64
diff
changeset
|
131 return redirect(url_for('.edit_tracking')) |
0 | 132 version = tracking._version |
133 version = version[:-1] + (version[-1] + 1,) | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
134 return render_template('document/edit_revision.j2', number='.'.join("%d"%v for v in version), date=utcnow(), action='Add') |
0 | 135 |
136 version = parseVersion(request.form['number']) | |
137 date = parseDate(request.form['date']) | |
138 revision = CVRFRevision(version, date, request.form['description']) | |
139 tracking.addRevision(revision) | |
140 if 'update_tracking' in request.form: | |
141 tracking._version = version | |
142 tracking._currentDate = date | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
143 return redirect(url_for('.view')) |
0 | 144 |
67
023080ffd995
Allow deletion of revisions
Benoît Allard <benoit.allard@greenbone.net>
parents:
66
diff
changeset
|
145 @document.route('/revision/del', methods=['POST']) |
023080ffd995
Allow deletion of revisions
Benoît Allard <benoit.allard@greenbone.net>
parents:
66
diff
changeset
|
146 @document_required |
023080ffd995
Allow deletion of revisions
Benoît Allard <benoit.allard@greenbone.net>
parents:
66
diff
changeset
|
147 def del_revision(): |
023080ffd995
Allow deletion of revisions
Benoît Allard <benoit.allard@greenbone.net>
parents:
66
diff
changeset
|
148 index = int(request.form['index']) |
68
33cdb9faed64
Improve deletion of revisions (input validation)
Benoît Allard <benoit.allard@greenbone.net>
parents:
67
diff
changeset
|
149 history = get_current()._tracking._history |
33cdb9faed64
Improve deletion of revisions (input validation)
Benoît Allard <benoit.allard@greenbone.net>
parents:
67
diff
changeset
|
150 if not (0 <= index < len(history)): |
33cdb9faed64
Improve deletion of revisions (input validation)
Benoît Allard <benoit.allard@greenbone.net>
parents:
67
diff
changeset
|
151 flash('Revision not found', 'danger') |
33cdb9faed64
Improve deletion of revisions (input validation)
Benoît Allard <benoit.allard@greenbone.net>
parents:
67
diff
changeset
|
152 abort(404) |
33cdb9faed64
Improve deletion of revisions (input validation)
Benoît Allard <benoit.allard@greenbone.net>
parents:
67
diff
changeset
|
153 del history[index] |
67
023080ffd995
Allow deletion of revisions
Benoît Allard <benoit.allard@greenbone.net>
parents:
66
diff
changeset
|
154 return redirect(url_for('.view')) |
023080ffd995
Allow deletion of revisions
Benoît Allard <benoit.allard@greenbone.net>
parents:
66
diff
changeset
|
155 |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
156 @document.route('/distribution/edit', methods=['GET', 'POST']) |
0 | 157 @document_required |
158 def edit_distribution(): | |
159 if request.method != 'POST': | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
160 return render_template('document/edit_distribution.j2', distribution=get_current()._distribution) |
0 | 161 |
162 get_current().setDistribution(request.form['distribution']) | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
163 return redirect(url_for('.view')) |
0 | 164 |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
165 @document.route('/severity/edit', methods=['GET', 'POST']) |
0 | 166 @document_required |
167 def edit_severity(): | |
168 severity = get_current()._aggregateseverity | |
169 if severity is None: | |
170 severity = CVRFAggregateSeverity('') | |
171 if request.method != 'POST': | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
172 return render_template('document/edit_severity.j2', severity=severity) |
0 | 173 if not request.form['severity']: |
174 severity = None | |
175 else: | |
176 severity._severity = request.form['severity'] | |
177 severity.setNamespace(request.form['namespace'] or None) | |
178 get_current().setAggregateSeverity(severity) | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
179 return redirect(url_for('.view')) |
0 | 180 |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
181 @document.route('/note/<int:ordinal>') |
0 | 182 @document_required |
183 def view_note(ordinal): | |
184 note = get_current().getNote(ordinal) | |
185 if note is None: | |
186 abort(404) | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
187 return render_template('document/view_note.j2', note=note) |
0 | 188 |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
189 @document.route('/note/<int:ordinal>/edit', methods=['GET', 'POST']) |
0 | 190 @document_required |
191 def edit_note(ordinal): | |
192 note = get_current().getNote(ordinal) | |
193 if note is None: | |
194 abort(404) | |
195 if request.method != 'POST': | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
196 return render_template('document/edit_note.j2', note=note, types = note.TYPES) |
0 | 197 |
58
fbc413b8a46e
Unify note update/creation from forms
Benoît Allard <benoit.allard@greenbone.net>
parents:
7
diff
changeset
|
198 update_note_from_request(note) |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
199 return redirect(url_for('.view_note', ordinal=note._ordinal )) |
0 | 200 |
201 | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
202 @document.route('/note/add', methods=['GET', 'POST']) |
0 | 203 @document_required |
204 def add_note(): | |
205 if request.method != 'POST': | |
206 next_ordinal = 1 | |
207 notes = get_current()._notes | |
208 if notes: | |
209 next_ordinal = notes[-1]._ordinal + 1 | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
210 return render_template('document/edit_note.j2', ordinal=next_ordinal, types=CVRFNote.TYPES, action='Add') |
0 | 211 |
58
fbc413b8a46e
Unify note update/creation from forms
Benoît Allard <benoit.allard@greenbone.net>
parents:
7
diff
changeset
|
212 note = create_note_from_request() |
0 | 213 get_current().addNote(note) |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
214 return redirect(url_for('.view')) |
0 | 215 |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
216 @document.route('/reference/<int:index>/edit', methods=['GET', 'POST']) |
0 | 217 @document_required |
218 def edit_reference(index): | |
219 try: | |
220 ref = get_current()._references[index] | |
221 except IndexError: | |
222 abort(404) | |
223 if request.method != 'POST': | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
224 return render_template('document/edit_reference.j2', _type=ref._type, url=ref._url, description=ref._description, types=('',) + ref.TYPES) |
0 | 225 |
61
55b72057b066
Unify reference update/creation from forms
Benoît Allard <benoit.allard@greenbone.net>
parents:
60
diff
changeset
|
226 update_reference_from_request(ref) |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
227 return redirect(url_for('.view')) |
0 | 228 |
229 | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
230 @document.route('/reference/add', methods=['GET', 'POST']) |
0 | 231 @document_required |
232 def add_reference(): | |
233 if request.method != 'POST': | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
234 return render_template('document/edit_reference.j2', action='Add', types=('',) + CVRFReference.TYPES) |
0 | 235 |
61
55b72057b066
Unify reference update/creation from forms
Benoît Allard <benoit.allard@greenbone.net>
parents:
60
diff
changeset
|
236 ref = create_reference_from_request() |
0 | 237 get_current().addReference(ref) |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
238 return redirect(url_for('.view')) |
0 | 239 |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
240 @document.route('/acknowledgment/<int:index>') |
0 | 241 @document_required |
242 def view_acknowledgment(index): | |
243 try: | |
244 ack = get_current()._acknowledgments[index] | |
245 except IndexError: | |
246 abort(404) | |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
247 return render_template('document/view_acknowledgment.j2', acknowledgment=ack, index=index, action='Update') |
0 | 248 |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
249 @document.route('/acknowledgment/<int:index>/edit', methods=['GET', 'POST']) |
0 | 250 @document_required |
251 def edit_acknowledgment(index): | |
252 try: | |
253 ack = get_current()._acknowledgments[index] | |
254 except IndexError: | |
255 abort(404) | |
256 if request.method != 'POST': | |
64
aad7db3f93b6
Add support for Acknowledgments with multiple names and organizations
Benoît Allard <benoit.allard@greenbone.net>
parents:
63
diff
changeset
|
257 return render_template('document/edit_acknowledgment.j2', |
aad7db3f93b6
Add support for Acknowledgments with multiple names and organizations
Benoît Allard <benoit.allard@greenbone.net>
parents:
63
diff
changeset
|
258 names=ack._names, organizations=ack._organizations, |
aad7db3f93b6
Add support for Acknowledgments with multiple names and organizations
Benoît Allard <benoit.allard@greenbone.net>
parents:
63
diff
changeset
|
259 description=ack._description, url=ack._url, |
aad7db3f93b6
Add support for Acknowledgments with multiple names and organizations
Benoît Allard <benoit.allard@greenbone.net>
parents:
63
diff
changeset
|
260 action='Update') |
0 | 261 |
60
c6e7175ff28c
Unify acknowledgments update/creation from forms
Benoît Allard <benoit.allard@greenbone.net>
parents:
58
diff
changeset
|
262 update_acknowledgment_from_request(ack) |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
263 return redirect(url_for('.view')) |
0 | 264 |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
265 @document.route('/acknowledgment/add', methods=['GET', 'POST']) |
0 | 266 @document_required |
267 def add_acknowledgment(): | |
268 if request.method != 'POST': | |
64
aad7db3f93b6
Add support for Acknowledgments with multiple names and organizations
Benoît Allard <benoit.allard@greenbone.net>
parents:
63
diff
changeset
|
269 return render_template('document/edit_acknowledgment.j2', |
aad7db3f93b6
Add support for Acknowledgments with multiple names and organizations
Benoît Allard <benoit.allard@greenbone.net>
parents:
63
diff
changeset
|
270 action='Add') |
0 | 271 |
60
c6e7175ff28c
Unify acknowledgments update/creation from forms
Benoît Allard <benoit.allard@greenbone.net>
parents:
58
diff
changeset
|
272 ack = create_acknowledgment_from_request() |
0 | 273 get_current().addAcknowledgment(ack) |
7
8f41bb7f4681
Move the Document management routines to a document Blueprint
Benoît Allard <benoit.allard@greenbone.net>
parents:
3
diff
changeset
|
274 return redirect(url_for('.view')) |