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
6d2ee1b0
Commit
6d2ee1b0
authored
Feb 19, 2006
by
Stefan H. Holek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZPublisher.BaseRequest: The publisher would happily publish attributes
of type 'bool' and 'complex'.
parent
1408344e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
1 deletion
+61
-1
doc/CHANGES.txt
doc/CHANGES.txt
+3
-0
lib/python/ZPublisher/BaseRequest.py
lib/python/ZPublisher/BaseRequest.py
+2
-1
lib/python/ZPublisher/tests/testBaseRequest.py
lib/python/ZPublisher/tests/testBaseRequest.py
+56
-0
No files found.
doc/CHANGES.txt
View file @
6d2ee1b0
...
...
@@ -27,6 +27,9 @@ Zope Changes
Bugs Fixed
- ZPublisher.BaseRequest: The publisher would happily publish attributes
of type 'bool' and 'complex'.
- Collector #1991: ZPublisher did not deal properly with a trailing
%20 in the URL
...
...
lib/python/ZPublisher/BaseRequest.py
View file @
6d2ee1b0
...
...
@@ -571,7 +571,8 @@ itypes = {}
for
name
in
(
'NoneType'
,
'IntType'
,
'LongType'
,
'FloatType'
,
'StringType'
,
'BufferType'
,
'TupleType'
,
'ListType'
,
'DictType'
,
'XRangeType'
,
'SliceType'
,
'EllipsisType'
,
'UnicodeType'
,
'CodeType'
,
'TracebackType'
,
'FrameType'
,
'DictProxyType'
):
'TracebackType'
,
'FrameType'
,
'DictProxyType'
,
'BooleanType'
,
'ComplexType'
):
if
hasattr
(
types
,
name
):
itypes
[
getattr
(
types
,
name
)]
=
0
...
...
lib/python/ZPublisher/tests/testBaseRequest.py
View file @
6d2ee1b0
...
...
@@ -16,6 +16,22 @@ class DummyObjectBasic(Implicit):
"""Attribute with docstring."""
return
'view content'
def
noview
(
self
):
# Attribute without docstring.
return
'unpublishable'
class
DummyObjectWithoutDocstring
(
Implicit
):
""
def
view
(
self
):
"""Attribute with docstring."""
return
'view content'
def
noview
(
self
):
# Attribute without docstring.
return
'unpublishable'
class
DummyObjectWithDefault
(
DummyObjectBasic
):
"""Dummy class with docstring."""
...
...
@@ -68,6 +84,7 @@ class DummyObjectWithBDBBT(DummyObjectWithBD):
return
getattr
(
self
,
name
)
raise
AttributeError
,
name
class
TestBaseRequest
(
TestCase
):
def
setUp
(
self
):
...
...
@@ -80,6 +97,11 @@ class TestBaseRequest(TestCase):
self
.
f1
.
_setObject
(
'objWithBD'
,
DummyObjectWithBD
()
)
self
.
f1
.
_setObject
(
'objWithBBT'
,
DummyObjectWithBBT
()
)
self
.
f1
.
_setObject
(
'objWithBDBBT'
,
DummyObjectWithBDBBT
()
)
self
.
f1
.
_setObject
(
'objWithoutDocstring'
,
DummyObjectWithoutDocstring
()
)
self
.
f1
.
simpleString
=
'foo'
self
.
f1
.
simpleList
=
[]
self
.
f1
.
simpleBoolean
=
True
self
.
f1
.
simpleComplex
=
complex
(
1
)
def
makeBaseRequest
(
self
):
response
=
HTTPResponse
()
...
...
@@ -183,6 +205,40 @@ class TestBaseRequest(TestCase):
self
.
assertEqual
(
r
.
URL
,
'/index_html'
)
self
.
assertEqual
(
r
.
response
.
base
,
''
)
def
test_traverse_attribute_with_docstring
(
self
):
r
=
self
.
makeBaseRequest
()
r
.
traverse
(
'folder/objBasic/view'
)
self
.
assertEqual
(
r
.
URL
,
'/folder/objBasic/view'
)
self
.
assertEqual
(
r
.
response
.
base
,
''
)
def
test_traverse_attribute_without_docstring
(
self
):
from
ZPublisher
import
NotFound
r
=
self
.
makeBaseRequest
()
self
.
assertRaises
(
NotFound
,
r
.
traverse
,
'folder/objBasic/noview'
)
def
test_traverse_class_without_docstring
(
self
):
from
ZPublisher
import
NotFound
r
=
self
.
makeBaseRequest
()
self
.
assertRaises
(
NotFound
,
r
.
traverse
,
'folder/objWithoutDocstring'
)
def
test_traverse_attribute_of_class_without_docstring
(
self
):
from
ZPublisher
import
NotFound
r
=
self
.
makeBaseRequest
()
self
.
assertRaises
(
NotFound
,
r
.
traverse
,
'folder/objWithoutDocstring/view'
)
def
test_traverse_attribute_and_class_without_docstring
(
self
):
from
ZPublisher
import
NotFound
r
=
self
.
makeBaseRequest
()
self
.
assertRaises
(
NotFound
,
r
.
traverse
,
'folder/objWithoutDocstring/noview'
)
def
test_traverse_simple_type
(
self
):
from
ZPublisher
import
NotFound
r
=
self
.
makeBaseRequest
()
self
.
assertRaises
(
NotFound
,
r
.
traverse
,
'folder/simpleString'
)
self
.
assertRaises
(
NotFound
,
r
.
traverse
,
'folder/simpleList'
)
self
.
assertRaises
(
NotFound
,
r
.
traverse
,
'folder/simpleBoolean'
)
self
.
assertRaises
(
NotFound
,
r
.
traverse
,
'folder/simpleComplex'
)
def
test_suite
():
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