Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Video AG Infrastruktur
website
Commits
761a55d8
Commit
761a55d8
authored
8 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Implemented auto-generation of a static 500-Page
parent
8b45d498
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
config.py.example
+1
-0
1 addition, 0 deletions
config.py.example
server.py
+10
-2
10 additions, 2 deletions
server.py
templates/500.html
+1
-1
1 addition, 1 deletion
templates/500.html
with
13 additions
and
3 deletions
.gitignore
+
1
−
0
View file @
761a55d8
...
@@ -3,3 +3,4 @@ config.py
...
@@ -3,3 +3,4 @@ config.py
__pycache__
__pycache__
*.sqlite
*.sqlite
files/*
files/*
static/500.html
This diff is collapsed.
Click to expand it.
config.py.example
+
1
−
0
View file @
761a55d8
...
@@ -20,3 +20,4 @@ SQLITE_INIT_DATA = False
...
@@ -20,3 +20,4 @@ SQLITE_INIT_DATA = False
#LDAP_HOST = 'ldaps://rumo.fsmpi.rwth-aachen.de'
#LDAP_HOST = 'ldaps://rumo.fsmpi.rwth-aachen.de'
#ICAL_URL = 'https://user:password@mail.fsmpi.rwth-aachen.de/SOGo/....ics'
#ICAL_URL = 'https://user:password@mail.fsmpi.rwth-aachen.de/SOGo/....ics'
ERROR_PAGE = 'static/500.html'
This diff is collapsed.
Click to expand it.
server.py
+
10
−
2
View file @
761a55d8
...
@@ -179,6 +179,16 @@ def handle_internal_error(e):
...
@@ -179,6 +179,16 @@ def handle_internal_error(e):
traceback
.
print_exc
()
traceback
.
print_exc
()
return
render_template
(
'
500.html
'
)
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...
# debian ships jinja2 without this test...
@app.template_test
(
name
=
'
equalto
'
)
@app.template_test
(
name
=
'
equalto
'
)
def
equalto
(
a
,
b
):
def
equalto
(
a
,
b
):
...
@@ -426,7 +436,6 @@ def edit(prefix='', ignore=[]):
...
@@ -426,7 +436,6 @@ def edit(prefix='', ignore=[]):
@app.route
(
'
/new/<table>
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
@app.route
(
'
/new/<table>
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
@mod_required
@mod_required
def
create
(
table
):
def
create
(
table
):
print
(
table
,
request
.
values
)
assert
table
in
tabs
assert
table
in
tabs
defaults
=
{
'
created_by
'
:
session
[
'
user
'
][
'
dbid
'
],
'
time_created
'
:
datetime
.
now
(),
'
time_updated
'
:
datetime
.
now
()}
defaults
=
{
'
created_by
'
:
session
[
'
user
'
][
'
dbid
'
],
'
time_created
'
:
datetime
.
now
(),
'
time_updated
'
:
datetime
.
now
()}
columns
=
[]
columns
=
[]
...
@@ -445,7 +454,6 @@ def create(table):
...
@@ -445,7 +454,6 @@ def create(table):
assert
column
not
in
defaults
assert
column
not
in
defaults
columns
.
append
(
column
)
columns
.
append
(
column
)
values
.
append
(
val
)
values
.
append
(
val
)
print
(
columns
,
values
)
id
=
modify
(
'
INSERT INTO %s (%s) VALUES (%s)
'
%
(
tabs
[
table
][
0
],
id
=
modify
(
'
INSERT INTO %s (%s) VALUES (%s)
'
%
(
tabs
[
table
][
0
],
'
,
'
.
join
(
columns
),
'
,
'
.
join
([
'
?
'
]
*
len
(
values
))),
*
values
)
'
,
'
.
join
(
columns
),
'
,
'
.
join
([
'
?
'
]
*
len
(
values
))),
*
values
)
if
'
ref
'
in
request
.
values
:
if
'
ref
'
in
request
.
values
:
...
...
This diff is collapsed.
Click to expand it.
templates/500.html
+
1
−
1
View file @
761a55d8
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
{% block content %}
{% block content %}
<div
class=
"panel panel-danger"
>
<div
class=
"panel panel-danger"
>
<div
class=
"panel-heading"
>
<div
class=
"panel-heading"
>
<h1
class=
"panel-title"
>
Interner Fehler
(500)
</h1>
<h1
class=
"panel-title"
>
Interner Fehler
</h1>
</div>
</div>
<div
class=
"row panel-body"
>
<div
class=
"row panel-body"
>
<div
class=
"col-xs-12"
>
<div
class=
"col-xs-12"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment