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
9657f85a
Commit
9657f85a
authored
Aug 27, 2006
by
Stefan H. Holek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZTUtils.make_hidden_input did not escape double-quotes.
Fixes
http://www.zope.org/Collectors/Zope/2175
parent
b17b217e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletion
+16
-1
doc/CHANGES.txt
doc/CHANGES.txt
+2
-0
lib/python/ZTUtils/Zope.py
lib/python/ZTUtils/Zope.py
+1
-1
lib/python/ZTUtils/tests/testZope.py
lib/python/ZTUtils/tests/testZope.py
+13
-0
No files found.
doc/CHANGES.txt
View file @
9657f85a
...
@@ -8,6 +8,8 @@ Zope Changes
...
@@ -8,6 +8,8 @@ Zope Changes
Bugs fixed
Bugs fixed
- Collector #2175: ZTUtils.make_hidden_input did not escape double-quotes.
- Collector #1907: Moved 'alt' property from File to Image.
- Collector #1907: Moved 'alt' property from File to Image.
- Collector #1983: Specifying session-resolution-seconds >= 1200 caused
- Collector #1983: Specifying session-resolution-seconds >= 1200 caused
...
...
lib/python/ZTUtils/Zope.py
View file @
9657f85a
...
@@ -200,7 +200,7 @@ def make_hidden_input(*args, **kwargs):
...
@@ -200,7 +200,7 @@ def make_hidden_input(*args, **kwargs):
d
.
update
(
arg
)
d
.
update
(
arg
)
d
.
update
(
kwargs
)
d
.
update
(
kwargs
)
hq
=
cgi
.
escape
hq
=
lambda
x
:
cgi
.
escape
(
x
,
quote
=
True
)
qlist
=
complex_marshal
(
d
.
items
())
qlist
=
complex_marshal
(
d
.
items
())
for
i
in
range
(
len
(
qlist
)):
for
i
in
range
(
len
(
qlist
)):
k
,
m
,
v
=
qlist
[
i
]
k
,
m
,
v
=
qlist
[
i
]
...
...
lib/python/ZTUtils/tests/testZope.py
View file @
9657f85a
...
@@ -5,6 +5,7 @@ from unittest import TestCase, makeSuite, main
...
@@ -5,6 +5,7 @@ from unittest import TestCase, makeSuite, main
import
string
import
string
import
urllib
import
urllib
from
ZTUtils.Zope
import
make_query
,
complex_marshal
from
ZTUtils.Zope
import
make_query
,
complex_marshal
from
ZTUtils.Zope
import
make_hidden_input
from
DateTime
import
DateTime
from
DateTime
import
DateTime
class
QueryTests
(
TestCase
):
class
QueryTests
(
TestCase
):
...
@@ -50,6 +51,18 @@ class QueryTests(TestCase):
...
@@ -50,6 +51,18 @@ class QueryTests(TestCase):
record
=
record
,
string
=
str_
)
record
=
record
,
string
=
str_
)
assert
query
==
'date:date=%s&integer:int=1&listing:int:list=1&listing:date:list=%s&listing:list=str&string=str&record.arg1:int:list:record=1&record.arg1:date:list:record=%s&record.arg1:list:record=str&record.arg2:int:record=1'
%
(
quote_date
,
quote_date
,
quote_date
)
assert
query
==
'date:date=%s&integer:int=1&listing:int:list=1&listing:date:list=%s&listing:list=str&string=str&record.arg1:int:list:record=1&record.arg1:date:list:record=%s&record.arg1:list:record=str&record.arg2:int:record=1'
%
(
quote_date
,
quote_date
,
quote_date
)
def
testMakeHiddenInput
(
self
):
tag
=
make_hidden_input
(
foo
=
'bar'
)
self
.
assertEqual
(
tag
,
'<input type="hidden" name="foo" value="bar">'
)
tag
=
make_hidden_input
(
foo
=
1
)
self
.
assertEqual
(
tag
,
'<input type="hidden" name="foo:int" value="1">'
)
# Escaping
tag
=
make_hidden_input
(
foo
=
'bar & baz'
)
self
.
assertEqual
(
tag
,
'<input type="hidden" name="foo" value="bar & baz">'
)
tag
=
make_hidden_input
(
foo
=
'<bar>'
)
self
.
assertEqual
(
tag
,
'<input type="hidden" name="foo" value="<bar>">'
)
tag
=
make_hidden_input
(
foo
=
'"bar"'
)
self
.
assertEqual
(
tag
,
'<input type="hidden" name="foo" value=""bar"">'
)
def
test_suite
():
def
test_suite
():
return
makeSuite
(
QueryTests
)
return
makeSuite
(
QueryTests
)
...
...
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