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
749344e5
Commit
749344e5
authored
Feb 10, 2000
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added html quoting to the __str__ method
parent
0b5a6864
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
lib/python/ZPublisher/HTTPRequest.py
lib/python/ZPublisher/HTTPRequest.py
+21
-7
No files found.
lib/python/ZPublisher/HTTPRequest.py
View file @
749344e5
...
@@ -83,7 +83,7 @@
...
@@ -83,7 +83,7 @@
#
#
##############################################################################
##############################################################################
__version__
=
'$Revision: 1.2
8
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
9
$'
[
11
:
-
2
]
import
regex
,
sys
,
os
,
string
import
regex
,
sys
,
os
,
string
from
string
import
lower
,
atoi
,
rfind
,
split
,
strip
,
join
,
upper
,
find
from
string
import
lower
,
atoi
,
rfind
,
split
,
strip
,
join
,
upper
,
find
...
@@ -819,28 +819,28 @@ class HTTPRequest(BaseRequest):
...
@@ -819,28 +819,28 @@ class HTTPRequest(BaseRequest):
result
=
"<h3>form</h3><table>"
result
=
"<h3>form</h3><table>"
row
=
'<tr valign="top" align="left"><th>%s</th><td>%s</td></tr>'
row
=
'<tr valign="top" align="left"><th>%s</th><td>%s</td></tr>'
for
k
,
v
in
self
.
form
.
items
():
for
k
,
v
in
self
.
form
.
items
():
result
=
result
+
row
%
(
k
,
v
)
result
=
result
+
row
%
(
html_quote
(
k
),
html_quote
(
v
)
)
result
=
result
+
"</table><h3>cookies</h3><table>"
result
=
result
+
"</table><h3>cookies</h3><table>"
for
k
,
v
in
self
.
cookies
.
items
():
for
k
,
v
in
self
.
cookies
.
items
():
result
=
result
+
row
%
(
k
,
v
)
result
=
result
+
row
%
(
html_quote
(
k
),
html_quote
(
v
)
)
result
=
result
+
"</table><h3>other</h3><table>"
result
=
result
+
"</table><h3>other</h3><table>"
for
k
,
v
in
self
.
other
.
items
():
for
k
,
v
in
self
.
other
.
items
():
if
k
in
(
'PARENTS'
,
'RESPONSE'
):
continue
if
k
in
(
'PARENTS'
,
'RESPONSE'
):
continue
result
=
result
+
row
%
(
k
,
v
)
result
=
result
+
row
%
(
html_quote
(
k
),
html_quote
(
v
)
)
for
n
in
"0123456789"
:
for
n
in
"0123456789"
:
key
=
"URL%s"
%
n
key
=
"URL%s"
%
n
try
:
result
=
result
+
row
%
(
key
,
self
[
key
]
)
try
:
result
=
result
+
row
%
(
key
,
html_quote
(
self
[
key
])
)
except
KeyError
:
pass
except
KeyError
:
pass
for
n
in
"0123456789"
:
for
n
in
"0123456789"
:
key
=
"BASE%s"
%
n
key
=
"BASE%s"
%
n
try
:
result
=
result
+
row
%
(
key
,
self
[
key
]
)
try
:
result
=
result
+
row
%
(
key
,
html_quote
(
self
[
key
])
)
except
KeyError
:
pass
except
KeyError
:
pass
result
=
result
+
"</table><h3>environ</h3><table>"
result
=
result
+
"</table><h3>environ</h3><table>"
for
k
,
v
in
self
.
environ
.
items
():
for
k
,
v
in
self
.
environ
.
items
():
if
not
hide_key
(
k
):
if
not
hide_key
(
k
):
result
=
result
+
row
%
(
k
,
v
)
result
=
result
+
row
%
(
html_quote
(
k
),
html_quote
(
v
)
)
return
result
+
"</table>"
return
result
+
"</table>"
__repr__
=
__str__
__repr__
=
__str__
...
@@ -876,6 +876,20 @@ def sane_environment(env):
...
@@ -876,6 +876,20 @@ def sane_environment(env):
return
dict
return
dict
# This is duplicated from DocumentTemplate.DT_Util to
# prevent a dependency on the DocumentTemplate package.
# Some folks still use the ZPublisher package as a
# standalone publisher without DocumentTemplate.
def
html_quote
(
value
,
character_entities
=
(
((
'&'
),
'&'
),
((
"<"
),
'<'
),
((
">"
),
'>'
),
((
'"'
),
'"'
))):
#"
text
=
str
(
value
)
for
re
,
name
in
character_entities
:
if
find
(
text
,
re
)
>=
0
:
text
=
join
(
split
(
text
,
re
),
name
)
return
text
def
str_field
(
v
):
def
str_field
(
v
):
if
type
(
v
)
is
ListType
:
if
type
(
v
)
is
ListType
:
...
...
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