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
46b5fec1
Commit
46b5fec1
authored
Feb 19, 2006
by
Stefan H. Holek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also prevent publishing of Python 2.4's 'set' and 'frozenset' types.
parent
9a3d5f68
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
lib/python/ZPublisher/BaseRequest.py
lib/python/ZPublisher/BaseRequest.py
+4
-0
lib/python/ZPublisher/tests/testBaseRequest.py
lib/python/ZPublisher/tests/testBaseRequest.py
+8
-0
No files found.
lib/python/ZPublisher/BaseRequest.py
View file @
46b5fec1
...
@@ -579,6 +579,10 @@ for name in ('NoneType', 'IntType', 'LongType', 'FloatType', 'StringType',
...
@@ -579,6 +579,10 @@ for name in ('NoneType', 'IntType', 'LongType', 'FloatType', 'StringType',
if
hasattr
(
types
,
name
):
if
hasattr
(
types
,
name
):
itypes
[
getattr
(
types
,
name
)]
=
0
itypes
[
getattr
(
types
,
name
)]
=
0
# Python 2.4 no longer maintains the types module.
itypes
[
set
]
=
0
itypes
[
frozenset
]
=
0
def
typeCheck
(
obj
,
deny
=
itypes
):
def
typeCheck
(
obj
,
deny
=
itypes
):
# Return true if its ok to publish the type, false otherwise.
# Return true if its ok to publish the type, false otherwise.
return
deny
.
get
(
type
(
obj
),
1
)
return
deny
.
get
(
type
(
obj
),
1
)
lib/python/ZPublisher/tests/testBaseRequest.py
View file @
46b5fec1
...
@@ -102,6 +102,8 @@ class TestBaseRequest(TestCase):
...
@@ -102,6 +102,8 @@ class TestBaseRequest(TestCase):
self
.
f1
.
simpleList
=
[]
self
.
f1
.
simpleList
=
[]
self
.
f1
.
simpleBoolean
=
True
self
.
f1
.
simpleBoolean
=
True
self
.
f1
.
simpleComplex
=
complex
(
1
)
self
.
f1
.
simpleComplex
=
complex
(
1
)
self
.
f1
.
simpleSet
=
set
([])
self
.
f1
.
simpleFrozenSet
=
frozenset
([])
def
makeBaseRequest
(
self
):
def
makeBaseRequest
(
self
):
response
=
HTTPResponse
()
response
=
HTTPResponse
()
...
@@ -239,6 +241,12 @@ class TestBaseRequest(TestCase):
...
@@ -239,6 +241,12 @@ class TestBaseRequest(TestCase):
self
.
assertRaises
(
NotFound
,
r
.
traverse
,
'folder/simpleBoolean'
)
self
.
assertRaises
(
NotFound
,
r
.
traverse
,
'folder/simpleBoolean'
)
self
.
assertRaises
(
NotFound
,
r
.
traverse
,
'folder/simpleComplex'
)
self
.
assertRaises
(
NotFound
,
r
.
traverse
,
'folder/simpleComplex'
)
def
test_traverse_set_type
(
self
):
from
ZPublisher
import
NotFound
r
=
self
.
makeBaseRequest
()
self
.
assertRaises
(
NotFound
,
r
.
traverse
,
'folder/simpleSet'
)
self
.
assertRaises
(
NotFound
,
r
.
traverse
,
'folder/simpleFrozenSet'
)
def
test_suite
():
def
test_suite
():
return
TestSuite
(
(
makeSuite
(
TestBaseRequest
),
)
)
return
TestSuite
(
(
makeSuite
(
TestBaseRequest
),
)
)
...
...
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