Commit 348f8803 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

Folder: fix objectValues(portal_type=...).

See merge request nexedi/erp5!1666
parents 62af8254 48cfa07a
Pipeline #23367 failed with stage
in 0 seconds
......@@ -1542,7 +1542,7 @@ class Folder(FolderMixIn, CopyContainer, ObjectManager, Base, OFSFolder2, CMFBTr
if portal_type is not None:
if isinstance(portal_type, str):
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:
checkPermission = getSecurityManager().checkPermission
object_list = [o for o in object_list
......
......@@ -37,7 +37,7 @@ import warnings
from Acquisition import aq_base
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
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):
"""
......@@ -283,6 +283,12 @@ class TestERP5Type(ERP5TypeTestCase, LogInterceptor):
warnings.warn('user warning', 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():
suite = unittest.TestSuite()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment