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
25969761
Commit
25969761
authored
Nov 15, 2006
by
Leonardo Rochael Almeida
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collector #2235. Stop ZCatalog.manage_catalogObject from doing boolean evaluation of found objects.
parent
e2b159d0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
doc/CHANGES.txt
doc/CHANGES.txt
+3
-0
lib/python/Products/ZCatalog/ZCatalog.py
lib/python/Products/ZCatalog/ZCatalog.py
+1
-1
lib/python/Products/ZCatalog/tests/testCatalog.py
lib/python/Products/ZCatalog/tests/testCatalog.py
+21
-0
No files found.
doc/CHANGES.txt
View file @
25969761
...
...
@@ -8,6 +8,9 @@ Zope Changes
Bugs fixed
- Collector #2235: ZCatalog.manage_catalogObject was triggering __len__
of objects that implement it, like containers.
- Fix yet another resTructuredText glitch, and add tests (test
backported from 2.9, which was not in fact vulnerable).
...
...
lib/python/Products/ZCatalog/ZCatalog.py
View file @
25969761
...
...
@@ -232,7 +232,7 @@ class ZCatalog(Folder, Persistent, Implicit):
for
url
in
urls
:
obj
=
self
.
resolve_path
(
url
)
if
not
obj
:
if
obj
is
not
None
:
obj
=
self
.
resolve_url
(
url
,
REQUEST
)
if
obj
is
not
None
:
self
.
catalog_object
(
obj
,
url
)
...
...
lib/python/Products/ZCatalog/tests/testCatalog.py
View file @
25969761
...
...
@@ -246,6 +246,27 @@ class TestZCatalog(unittest.TestCase):
result
=
self
.
_catalog
(
title
=
'9999'
)
self
.
assertEquals
(
1
,
len
(
result
))
def
test_manage_catalogObject_does_not_trigger_boolean_eval
(
self
):
# make objects with __len__ and __nonzero__
class
mydummy1
:
def
__init__
(
self
,
fail
):
self
.
fail
=
fail
def
__len__
(
self
):
self
.
fail
(
"__len__() was called"
)
class
mydummy2
:
def
__init__
(
self
,
fail
):
self
.
fail
=
fail
def
__nonzero__
(
self
):
self
.
fail
(
"__nonzero__() was called"
)
# store them to be found by the catalog
self
.
d
[
'0'
]
=
mydummy1
(
self
.
fail
)
self
.
d
[
'1'
]
=
mydummy2
(
self
.
fail
)
# create a fake response that doesn't bomb on manage_catalogObject()
class
myresponse
:
def
redirect
(
self
,
url
):
pass
# this next call should not fail
self
.
_catalog
.
manage_catalogObject
(
None
,
myresponse
(),
'URL1'
,
urls
=
(
'0'
,
'1'
))
class
dummy
(
ExtensionClass
.
Base
):
att1
=
'att1'
...
...
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