comparison farol/main.py @ 102:65341d05a8f8

Spawn a Modal when loading a doc, and another one is already loaded
author Benoît Allard <benoit.allard@greenbone.net>
date Tue, 14 Oct 2014 10:25:43 +0200
parents ce49bd1512dd
children 67c4b299736e
comparison
equal deleted inserted replaced
101:21a1a69b4525 102:65341d05a8f8
78 try: 78 try:
79 cvrf.validate() 79 cvrf.validate()
80 error = None 80 error = None
81 except ValidationError as ve: 81 except ValidationError as ve:
82 error = ve 82 error = ve
83 return dict(has_current=True, vulnerabilities=vulns, products=prods, error=error) 83 return dict(has_current=True, vulnerabilities=vulns, products=prods,
84 error=error, current_id=cvrf.getDocId())
84 85
85 @app.template_filter('secure_filename') 86 @app.template_filter('secure_filename')
86 def makeId(string): 87 def makeId(string):
87 return secure_filename(string) 88 return secure_filename(string)
88 89
138 set_current(doc) 139 set_current(doc)
139 140
140 @app.route('/new', methods=['GET', 'POST']) 141 @app.route('/new', methods=['GET', 'POST'])
141 def new(): 142 def new():
142 if request.method != 'POST': 143 if request.method != 'POST':
143 current_id = None 144 return render_template('new.j2', has_document=has_current(), now=utcnow())
144 if has_current():
145 current_id = get_current().getDocId()
146 return render_template('new.j2', has_document=has_current(), now=utcnow(), current_id=current_id)
147 145
148 if 'rhsa' in request.form: 146 if 'rhsa' in request.form:
149 set_RHSA(request.form['id']) 147 set_RHSA(request.form['id'])
150 elif 'oracle' in request.form: 148 elif 'oracle' in request.form:
151 set_oracle(request.form['id']) 149 set_oracle(request.form['id'])

http://farol.wald.intevation.org