Commit 761a55d8 authored by Julian Rother's avatar Julian Rother
Browse files

Implemented auto-generation of a static 500-Page

parent 8b45d498
......@@ -3,3 +3,4 @@ config.py
__pycache__
*.sqlite
files/*
static/500.html
......@@ -20,3 +20,4 @@ SQLITE_INIT_DATA = False
#LDAP_HOST = 'ldaps://rumo.fsmpi.rwth-aachen.de'
#ICAL_URL = 'https://user:password@mail.fsmpi.rwth-aachen.de/SOGo/....ics'
ERROR_PAGE = 'static/500.html'
......@@ -179,6 +179,16 @@ def handle_internal_error(e):
traceback.print_exc()
return render_template('500.html')
@sched_func(5*60, firstdelay=0)
def dump_error_page():
if 'ERROR_PAGE' not in config:
return
request.url_rule = Rule(request.path, endpoint='handle_internal_error')
text = render_template('500.html')
f = open(config['ERROR_PAGE'], 'w')
f.write(text)
f.close()
# debian ships jinja2 without this test...
@app.template_test(name='equalto')
def equalto(a,b):
......@@ -426,7 +436,6 @@ def edit(prefix='', ignore=[]):
@app.route('/new/<table>', methods=['GET', 'POST'])
@mod_required
def create(table):
print(table, request.values)
assert table in tabs
defaults = {'created_by': session['user']['dbid'], 'time_created': datetime.now(), 'time_updated': datetime.now()}
columns = []
......@@ -445,7 +454,6 @@ def create(table):
assert column not in defaults
columns.append(column)
values.append(val)
print(columns, values)
id = modify('INSERT INTO %s (%s) VALUES (%s)'%(tabs[table][0],
','.join(columns), ','.join(['?']*len(values))), *values)
if 'ref' in request.values:
......
......@@ -2,7 +2,7 @@
{% block content %}
<div class="panel panel-danger">
<div class="panel-heading">
<h1 class="panel-title">Interner Fehler (500)</h1>
<h1 class="panel-title">Interner Fehler</h1>
</div>
<div class="row panel-body">
<div class="col-xs-12">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment