Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Roque
erp5
Commits
348f8803
Commit
348f8803
authored
Sep 07, 2022
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Plain Diff
Folder: fix objectValues(portal_type=...).
See merge request
nexedi/erp5!1666
parents
62af8254
48cfa07a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
product/ERP5Type/Core/Folder.py
product/ERP5Type/Core/Folder.py
+1
-1
product/ERP5Type/tests/testERP5Type.py
product/ERP5Type/tests/testERP5Type.py
+7
-1
No files found.
product/ERP5Type/Core/Folder.py
View file @
348f8803
...
@@ -1542,7 +1542,7 @@ class Folder(FolderMixIn, CopyContainer, ObjectManager, Base, OFSFolder2, CMFBTr
...
@@ -1542,7 +1542,7 @@ class Folder(FolderMixIn, CopyContainer, ObjectManager, Base, OFSFolder2, CMFBTr
if
portal_type
is
not
None
:
if
portal_type
is
not
None
:
if
isinstance
(
portal_type
,
str
):
if
isinstance
(
portal_type
,
str
):
portal_type
=
(
portal_type
,)
portal_type
=
(
portal_type
,)
object_list
=
[
x
for
x
in
object_list
if
x
.
getPortalType
()
in
portal_type
]
object_list
=
[
x
for
x
in
object_list
if
getattr
(
aq_base
(
x
),
'getPortalType'
,
lambda
:
None
)
()
in
portal_type
]
if
checked_permission
is
not
None
:
if
checked_permission
is
not
None
:
checkPermission
=
getSecurityManager
().
checkPermission
checkPermission
=
getSecurityManager
().
checkPermission
object_list
=
[
o
for
o
in
object_list
object_list
=
[
o
for
o
in
object_list
...
...
product/ERP5Type/tests/testERP5Type.py
View file @
348f8803
...
@@ -37,7 +37,7 @@ import warnings
...
@@ -37,7 +37,7 @@ import warnings
from
Acquisition
import
aq_base
from
Acquisition
import
aq_base
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
AccessControl.ZopeGuards
import
guarded_import
from
AccessControl.ZopeGuards
import
guarded_import
from
Products.ERP5Type.tests.utils
import
LogInterceptor
from
Products.ERP5Type.tests.utils
import
LogInterceptor
,
createZODBPythonScript
class
TestERP5Type
(
ERP5TypeTestCase
,
LogInterceptor
):
class
TestERP5Type
(
ERP5TypeTestCase
,
LogInterceptor
):
"""
"""
...
@@ -283,6 +283,12 @@ class TestERP5Type(ERP5TypeTestCase, LogInterceptor):
...
@@ -283,6 +283,12 @@ class TestERP5Type(ERP5TypeTestCase, LogInterceptor):
warnings
.
warn
(
'user warning'
,
DeprecationWarning
)
warnings
.
warn
(
'user warning'
,
DeprecationWarning
)
self
.
assertEqual
(
self
.
logged
[
-
1
].
name
,
'DeprecationWarning'
)
self
.
assertEqual
(
self
.
logged
[
-
1
].
name
,
'DeprecationWarning'
)
def
test_objectValues
(
self
):
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
)
createZODBPythonScript
(
person
,
'script'
,
''
,
''
)
script
=
person
[
'script'
]
self
.
assertIn
(
script
,
person
.
objectValues
())
self
.
assertNotIn
(
script
,
person
.
objectValues
(
portal_type
=
'Person'
))
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
...
...
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