Commit 49e44d18 authored by Aurel's avatar Aurel

fix call of HBTree method when using a base_id parameter to avoid

confusing between None and marker
add test for this


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17078 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bfbcc158
...@@ -746,21 +746,27 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn, ...@@ -746,21 +746,27 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn,
else: else:
return CMFBTreeFolder._checkObjectId(self, id) return CMFBTreeFolder._checkObjectId(self, id)
def objectIds(self, spec=None, base_id=None): def objectIds(self, spec=None, **kw):
if self._folder_handler == HBTREE_HANDLER: if self._folder_handler == HBTREE_HANDLER:
if self._htree is None: if self._htree is None:
return [] return []
return CMFHBTreeFolder.objectIds(self, base_id) if kw.has_key("base_id"):
return CMFHBTreeFolder.objectIds(self, base_id=kw["base_id"])
else:
return CMFHBTreeFolder.objectIds(self)
else: else:
if self._tree is None: if self._tree is None:
return [] return []
return CMFBTreeFolder.objectIds(self, spec) return CMFBTreeFolder.objectIds(self, spec)
def objectItems(self, spec=None, base_id=None): def objectItems(self, **kw):
if self._folder_handler == HBTREE_HANDLER: if self._folder_handler == HBTREE_HANDLER:
if self._htree is None: if self._htree is None:
return [] return []
return CMFHBTreeFolder.objectItems(self, base_id) if kw.has_key("base_id"):
return CMFHBTreeFolder.objectItems(self, base_id=kw["base_id"])
else:
return CMFHBTreeFolder.objectItems(self)
else: else:
if self._tree is None: if self._tree is None:
return [] return []
...@@ -1352,8 +1358,8 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn, ...@@ -1352,8 +1358,8 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn,
security.declareProtected( Permissions.AccessContentsInformation, security.declareProtected( Permissions.AccessContentsInformation,
'objectValues' ) 'objectValues' )
def objectValues(self, spec=None, meta_type=None, portal_type=None, def objectValues(self, spec=None, meta_type=None, portal_type=None,
sort_on=None, sort_order=None, base_id=None, sort_on=None, sort_order=None, checked_permission=None,
checked_permission=None, **kw): **kw):
# Returns list of objects contained in this folder. # Returns list of objects contained in this folder.
# (no docstring to prevent publishing) # (no docstring to prevent publishing)
...@@ -1372,7 +1378,10 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn, ...@@ -1372,7 +1378,10 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn,
if self._htree is None: if self._htree is None:
object_list = [] object_list = []
else: else:
object_list = CMFHBTreeFolder.objectValues(self, base_id=base_id) if kw.has_key("base_id"):
object_list = CMFHBTreeFolder.objectValues(self, base_id=kw['base_id'])
else:
object_list = CMFHBTreeFolder.objectValues(self)
else: else:
if self._tree is None: if self._tree is None:
object_list = [] object_list = []
......
...@@ -115,6 +115,12 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): ...@@ -115,6 +115,12 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor):
self.assertEqual(self.folder.isHBTree(), True) self.assertEqual(self.folder.isHBTree(), True)
self.assertEqual(len(self.folder.getTreeIdList()), 1) self.assertEqual(len(self.folder.getTreeIdList()), 1)
self.assertEqual(len(self.folder.objectIds()), 3) self.assertEqual(len(self.folder.objectIds()), 3)
# check params of objectIds in case of hbtree
self.assertEqual(len(self.folder.objectIds(base_id=None)), 0)
LOG("test", 300, "rien")
self.assertEqual(len(self.folder.objectValues()), 3)
LOG("test", 300, "base_id")
self.assertEqual(len(self.folder.objectValues(base_id=None)), 0)
# check object ids # check object ids
from DateTime import DateTime from DateTime import DateTime
date = DateTime().Date() date = DateTime().Date()
......
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