Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jannik Hellenkamp
website
Commits
761a55d8
Commit
761a55d8
authored
Oct 11, 2016
by
Julian Rother
Browse files
Implemented auto-generation of a static 500-Page
parent
8b45d498
Changes
4
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
761a55d8
...
...
@@ -3,3 +3,4 @@ config.py
__pycache__
*.sqlite
files/*
static/500.html
config.py.example
View file @
761a55d8
...
...
@@ -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'
server.py
View file @
761a55d8
...
...
@@ -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
:
...
...
templates/500.html
View file @
761a55d8
...
...
@@ -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"
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment