changeset 141:ce39a5267998

Add an export to the error page, and an exploding endpoint
author Benoît Allard <benoit.allard@greenbone.net>
date Tue, 28 Oct 2014 09:55:18 +0100
parents 3a56d5501ffa
children 6d3fb8592ff4
files farol/main.py farol/templates/error.j2
diffstat 2 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/farol/main.py	Mon Oct 27 16:46:18 2014 +0100
+++ b/farol/main.py	Tue Oct 28 09:55:18 2014 +0100
@@ -38,7 +38,7 @@
 
 import flask
 from flask import (Flask, request, render_template, redirect, url_for, flash,
-     make_response)
+     make_response, abort)
 from werkzeug import secure_filename
 
 from . import __version__, cache
@@ -94,6 +94,10 @@
 def error_page(error):
     return render_template('error.j2', e=error), getattr(error, 'code', 500)
 
+@app.route('/500')
+def boom():
+    abort(500)
+
 @app.route('/')
 def welcome():
     return render_template('welcome.j2',
--- a/farol/templates/error.j2	Mon Oct 27 16:46:18 2014 +0100
+++ b/farol/templates/error.j2	Tue Oct 28 09:55:18 2014 +0100
@@ -9,7 +9,19 @@
 {% if e.description %}<p>{{ e.description }}</p><hr>{% endif %}
 {% if e.code != 404 %}
   <p>Software are not without bugs. Looks like, you found one ... A trace has been written to the logs.</p>
-  <p>If you keep coming to this page, you might want to delete your document, and start again with a fresh one ...</p>
-  <div class="pull-right">{{ POST_button(url_for('document.delete'), text="Delete document", style="btn-danger") }}</div>
+  <div class="row">
+    <div class="col-lg-6">
+      <div class="thumbnail clearfix">
+        <p>If you keep coming to this page, you might want to delete your document, and start again with a fresh one ...</p>
+        <div class="pull-right">{{ POST_button(url_for('document.delete'), text="Delete document", style="btn-danger") }}</div>
+      </div>
+    </div>
+    <div class="col-lg-6">
+    <div class="thumbnail clearfix">
+      <p><strong>First</strong>, you might want to download your document (if it works !)</p>
+      <p><a class="btn btn-success pull-right" href="{{ url_for('render', format_='cvrf', raw=1) }}">Download document</a></p>
+    </div>
+    </div>
+  </div>
 {% endif %}
 {% endblock %}

http://farol.wald.intevation.org