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
7bf0ae95
Commit
7bf0ae95
authored
Jan 22, 2001
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge from 2.3
parent
a1bb13f5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
60 deletions
+22
-60
ZServer/HTTPResponse.py
ZServer/HTTPResponse.py
+0
-25
lib/python/ZPublisher/HTTPResponse.py
lib/python/ZPublisher/HTTPResponse.py
+22
-10
lib/python/ZServer/HTTPResponse.py
lib/python/ZServer/HTTPResponse.py
+0
-25
No files found.
ZServer/HTTPResponse.py
View file @
7bf0ae95
...
...
@@ -132,31 +132,6 @@ class ZServerHTTPResponse(HTTPResponse):
headers
=
self
.
headers
body
=
self
.
body
if
body
:
isHTML
=
contHTML
=
self
.
isHTML
(
body
)
if
not
headers
.
has_key
(
'content-type'
):
if
isHTML
:
c
=
'text/html'
else
:
c
=
'text/plain'
self
.
setHeader
(
'content-type'
,
c
)
# Don't try to fix user HTML
#else:
# isHTML = string.split(headers.get('content-type', ''),
# ';')[0] == 'text/html'
#if isHTML and end_of_header_search(self.body) < 0:
# lhtml=html_search(body)
# if lhtml >= 0:
# lhtml=lhtml+6
# body='%s<head></head>\n%s' % (body[:lhtml],body[lhtml:])
# elif contHTML:
# body='<html><head></head>\n' + body
# else:
# body='<html><head></head>\n' + body + '\n</html>\n'
# self.setBody(body)
# body=self.body
# set 204 (no content) status if 200 and response is empty
# and not streaming
...
...
lib/python/ZPublisher/HTTPResponse.py
View file @
7bf0ae95
...
...
@@ -84,8 +84,8 @@
##############################################################################
'''CGI Response Output formatter
$Id: HTTPResponse.py,v 1.4
0 2000/12/27 16:36:12
brian Exp $'''
__version__
=
'$Revision: 1.4
0
$'
[
11
:
-
2
]
$Id: HTTPResponse.py,v 1.4
1 2001/01/22 16:58:30
brian Exp $'''
__version__
=
'$Revision: 1.4
1
$'
[
11
:
-
2
]
import
string
,
types
,
sys
,
regex
,
re
from
string
import
find
,
rfind
,
lower
,
upper
,
strip
,
split
,
join
,
translate
...
...
@@ -272,6 +272,10 @@ class HTTPResponse(BaseResponse):
def
setBody
(
self
,
body
,
title
=
''
,
is_error
=
0
,
bogus_str_search
=
regex
.
compile
(
" [a-fA-F0-9]+>$"
).
search
,
latin1_alias_match
=
re
.
compile
(
r'text/html(\
s*;
\s*charset=((latin)|(latin[-_]?1)|'
r'(cp1252)|(cp819)|(csISOLatin1)|(IBM819)|(iso-ir-100)|'
r'(iso[-_]8859[-_]1(:1987)?)))?$'
,
re
.
I
).
match
):
'''
\
Set the body of the response
...
...
@@ -298,6 +302,22 @@ class HTTPResponse(BaseResponse):
body
=
body
.
asHTML
()
body
=
str
(
body
)
isHTML
=
self
.
isHTML
(
body
)
if
not
self
.
headers
.
has_key
(
'content-type'
):
if
isHTML
:
c
=
'text/html'
else
:
c
=
'text/plain'
self
.
setHeader
(
'content-type'
,
c
)
# Some browsers interpret certain characters in Latin 1 as html
# special characters. These cannot be removed by html_quote,
# because this is not the case for all encodings.
content_type
=
self
.
headers
[
'content-type'
]
if
content_type
==
'text/html'
or
latin1_alias_match
(
content_type
)
is
not
None
:
body
=
join
(
split
(
body
,
'
\
213
'
),
'<'
)
body
=
join
(
split
(
body
,
'
\
233
'
),
'>'
)
l
=
len
(
body
)
if
(
find
(
body
,
'>'
)
==
l
-
1
and
body
[:
1
]
==
'<'
and
l
<
200
and
...
...
@@ -689,14 +709,6 @@ class HTTPResponse(BaseResponse):
headers
=
self
.
headers
body
=
self
.
body
if
body
:
isHTML
=
contHTML
=
self
.
isHTML
(
body
)
if
not
headers
.
has_key
(
'content-type'
):
if
isHTML
:
c
=
'text/html'
else
:
c
=
'text/plain'
self
.
setHeader
(
'content-type'
,
c
)
if
not
headers
.
has_key
(
'content-length'
)
and
\
not
headers
.
has_key
(
'transfer-encoding'
):
...
...
lib/python/ZServer/HTTPResponse.py
View file @
7bf0ae95
...
...
@@ -132,31 +132,6 @@ class ZServerHTTPResponse(HTTPResponse):
headers
=
self
.
headers
body
=
self
.
body
if
body
:
isHTML
=
contHTML
=
self
.
isHTML
(
body
)
if
not
headers
.
has_key
(
'content-type'
):
if
isHTML
:
c
=
'text/html'
else
:
c
=
'text/plain'
self
.
setHeader
(
'content-type'
,
c
)
# Don't try to fix user HTML
#else:
# isHTML = string.split(headers.get('content-type', ''),
# ';')[0] == 'text/html'
#if isHTML and end_of_header_search(self.body) < 0:
# lhtml=html_search(body)
# if lhtml >= 0:
# lhtml=lhtml+6
# body='%s<head></head>\n%s' % (body[:lhtml],body[lhtml:])
# elif contHTML:
# body='<html><head></head>\n' + body
# else:
# body='<html><head></head>\n' + body + '\n</html>\n'
# self.setBody(body)
# body=self.body
# set 204 (no content) status if 200 and response is empty
# and not streaming
...
...
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