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
483b3051
Commit
483b3051
authored
Jul 25, 1996
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Fixed bug in recognizing HTML exception values.
- Added transaction support.
parent
d6ee52de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
lib/python/ZPublisher/Response.py
lib/python/ZPublisher/Response.py
+14
-5
No files found.
lib/python/ZPublisher/Response.py
View file @
483b3051
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
__doc__
=
'''CGI Response Output formatter
__doc__
=
'''CGI Response Output formatter
$Id: Response.py,v 1.
5 1996/07/10 22:45:57
jfulton Exp $'''
$Id: Response.py,v 1.
6 1996/07/25 16:44:24
jfulton Exp $'''
# Copyright
# Copyright
#
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
...
@@ -55,6 +55,10 @@ $Id: Response.py,v 1.5 1996/07/10 22:45:57 jfulton Exp $'''
...
@@ -55,6 +55,10 @@ $Id: Response.py,v 1.5 1996/07/10 22:45:57 jfulton Exp $'''
# (540) 371-6909
# (540) 371-6909
#
#
# $Log: Response.py,v $
# $Log: Response.py,v $
# Revision 1.6 1996/07/25 16:44:24 jfulton
# - Fixed bug in recognizing HTML exception values.
# - Added transaction support.
#
# Revision 1.5 1996/07/10 22:45:57 jfulton
# Revision 1.5 1996/07/10 22:45:57 jfulton
# Made exception handling fussier about exception values.
# Made exception handling fussier about exception values.
# Now the value must contain white space to be considered an error
# Now the value must contain white space to be considered an error
...
@@ -85,7 +89,7 @@ $Id: Response.py,v 1.5 1996/07/10 22:45:57 jfulton Exp $'''
...
@@ -85,7 +89,7 @@ $Id: Response.py,v 1.5 1996/07/10 22:45:57 jfulton Exp $'''
#
#
#
#
#
#
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
6
$'
[
11
:
-
2
]
import
string
,
types
,
sys
,
regex
import
string
,
types
,
sys
,
regex
...
@@ -197,7 +201,7 @@ class Response:
...
@@ -197,7 +201,7 @@ class Response:
If stream oriented output is used, then the response object
If stream oriented output is used, then the response object
passed into the object must be used.
passed into the object must be used.
"""
"""
#'
def
__init__
(
self
,
body
=
''
,
status
=
200
,
headers
=
None
,
def
__init__
(
self
,
body
=
''
,
status
=
200
,
headers
=
None
,
...
@@ -205,7 +209,8 @@ class Response:
...
@@ -205,7 +209,8 @@ class Response:
'''
\
'''
\
Creates a new response. In effect, the constructor calls
Creates a new response. In effect, the constructor calls
"self.setBody(body); self.setStatus(status); for name in
"self.setBody(body); self.setStatus(status); for name in
headers.keys(): self.setHeader(name, headers[name])"'''
headers.keys(): self.setHeader(name, headers[name])"
'''
if
not
headers
:
if
not
headers
:
headers
=
{}
headers
=
{}
self
.
headers
=
headers
self
.
headers
=
headers
...
@@ -374,6 +379,10 @@ class Response:
...
@@ -374,6 +379,10 @@ class Response:
def
exception
(
self
):
def
exception
(
self
):
t
,
v
,
tb
=
sys
.
exc_type
,
sys
.
exc_value
,
sys
.
exc_traceback
t
,
v
,
tb
=
sys
.
exc_type
,
sys
.
exc_value
,
sys
.
exc_traceback
# Abort running transaction, if any:
try
:
get_transaction
().
abort
()
except
:
pass
self
.
setStatus
(
t
)
self
.
setStatus
(
t
)
if
self
.
status
>=
300
and
self
.
status
<
400
:
if
self
.
status
>=
300
and
self
.
status
<
400
:
if
type
(
v
)
==
types
.
StringType
and
absuri_re
.
match
(
v
)
>=
0
:
if
type
(
v
)
==
types
.
StringType
and
absuri_re
.
match
(
v
)
>=
0
:
...
@@ -389,7 +398,7 @@ class Response:
...
@@ -389,7 +398,7 @@ class Response:
except
:
pass
except
:
pass
b
=
v
b
=
v
if
type
(
b
)
is
not
types
.
StringType
or
regex
.
search
(
'
\
t
\
n
'
,
b
)
<
0
:
if
type
(
b
)
is
not
types
.
StringType
or
regex
.
search
(
'
[
\
t
\
n
]
'
,
b
)
<
0
:
return
self
.
setBody
(
return
self
.
setBody
(
(
str
(
t
),
(
str
(
t
),
'Sorry, an error occurred.<p>'
'Sorry, an error occurred.<p>'
...
...
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