avoid error in error handler and render 500 page
This commit is contained in:
parent
d7b53aa322
commit
b4074303ba
2 changed files with 35 additions and 10 deletions
|
@ -25,7 +25,7 @@ class ErrorHandler(logging.Handler):
|
||||||
text = ''
|
text = ''
|
||||||
url = ''
|
url = ''
|
||||||
try:
|
try:
|
||||||
if sys.version_info < (2,5):
|
if sys.version_info < (2, 5):
|
||||||
# A nasty workaround required because Python 2.4's logging
|
# A nasty workaround required because Python 2.4's logging
|
||||||
# module doesn't support passing in extra context.
|
# module doesn't support passing in extra context.
|
||||||
# For this handler, the only extra data we need is the
|
# For this handler, the only extra data we need is the
|
||||||
|
@ -53,11 +53,14 @@ class ErrorHandler(logging.Handler):
|
||||||
|
|
||||||
text = "%s\n\n%s" % (stack_trace, request_repr)
|
text = "%s\n\n%s" % (stack_trace, request_repr)
|
||||||
if text:
|
if text:
|
||||||
l = models.Log(
|
try:
|
||||||
text=text,
|
l = models.Log(
|
||||||
line=line,
|
text=text,
|
||||||
url=url
|
line=line,
|
||||||
)
|
url=url
|
||||||
if user:
|
)
|
||||||
l.user = user
|
if user:
|
||||||
l.save()
|
l.user = user
|
||||||
|
l.save()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
|
@ -1 +1,23 @@
|
||||||
500 error
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>We will be back in a moment.</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/static/oxjs/min/UI/css/UI.css"/>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
img {
|
||||||
|
width: 256px;
|
||||||
|
padding-top: 128px;
|
||||||
|
}
|
||||||
|
div {
|
||||||
|
padding-top: 16px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body class="OxThemeOxmedium">
|
||||||
|
<img src="/static/png/logo.png"/>
|
||||||
|
<div class="OxSelectable">We will be back in a moment.</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue