Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
a1d7d5dc
Commit
a1d7d5dc
authored
Sep 05, 2016
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update HTTPExceptionHandler and make it slightly easier to subclass.
parent
d02792d6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
src/ZPublisher/httpexceptions.py
src/ZPublisher/httpexceptions.py
+13
-5
No files found.
src/ZPublisher/httpexceptions.py
View file @
a1d7d5dc
...
...
@@ -18,8 +18,12 @@ from zExceptions import (
)
ERROR_HTML
=
"""
\
<!DOCTYPE html>
<html>
<head><title>Site Error</title></head>
<head>
<title>Site Error</title>
<meta charset="utf-8" />
</head>
<body bgcolor="#FFFFFF">
<h2>Site Error</h2>
<p>An error was encountered while publishing this resource.
...
...
@@ -40,7 +44,8 @@ ERROR_HTML = """\
<p>If the error persists please contact the site maintainer.
Thank you for your patience.
</p></body></html>"""
</p>
</body></html>"""
class
HTTPExceptionHandler
(
object
):
...
...
@@ -55,9 +60,12 @@ class HTTPExceptionHandler(object):
except
HTTPException
as
exc
:
return
exc
(
environ
,
start_response
)
except
Exception
as
exc
:
wrapper
=
InternalError
()
wrapper
.
setBody
(
ERROR_HTML
%
repr
(
exc
))
return
wrapper
(
environ
,
start_response
)
return
self
.
catch_all_response
(
exc
)(
environ
,
start_response
)
def
catch_all_response
(
self
,
exc
):
response
=
InternalError
()
response
.
setBody
(
ERROR_HTML
%
repr
(
exc
))
return
response
def
main
(
app
,
global_conf
=
None
):
...
...
Write
Preview
Markdown
is supported
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