Commit 2a1b92fc authored by Jérome Perrin's avatar Jérome Perrin

If we have a fallback category, it's not a problem if the acquisition object

doesn't have the original base category.
The use case is that for destination_region to work on a movement (the
movement should acquire the region from the destination node), the node itself
doesn't have to define destination_region category.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15606 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d0d1b4d2
...@@ -838,7 +838,6 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -838,7 +838,6 @@ class CategoryTool( UniqueObject, Folder, Base ):
#LOG("Get Acquired Category acquired_object_dict: ",0,str(acquired_object_dict)) #LOG("Get Acquired Category acquired_object_dict: ",0,str(acquired_object_dict))
# XXX We must use filters in the future # XXX We must use filters in the future
# where_expression = self._buildQuery(spec, filter, kw) # where_expression = self._buildQuery(spec, filter, kw)
portal_type = kw.get('portal_type', ()) portal_type = kw.get('portal_type', ())
if spec is (): spec = portal_type # This is bad XXX - JPS - spec is for meta_type, not for portal_type - be consistent ! if spec is (): spec = portal_type # This is bad XXX - JPS - spec is for meta_type, not for portal_type - be consistent !
...@@ -964,10 +963,11 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -964,10 +963,11 @@ class CategoryTool( UniqueObject, Folder, Base ):
# continue # continue
#acquired_object_dict[my_acquisition_object_path] = 1 #acquired_object_dict[my_acquisition_object_path] = 1
#if hasattr(my_acquisition_object, '_categories'): # This would be a bug since we have category acquisition #if hasattr(my_acquisition_object, '_categories'): # This would be a bug since we have category acquisition
# We should only consider objects which define that category
#LOG('my_acquisition_object',0, str(getattr(my_acquisition_object, '_categories', ()))) #LOG('my_acquisition_object',0, str(getattr(my_acquisition_object, '_categories', ())))
#LOG('my_acquisition_object',0, str(base_category)) #LOG('my_acquisition_object',0, str(base_category))
if base_category in getattr(my_acquisition_object, '_categories', ()):
# We should only consider objects which define that category
if base_category in getattr(my_acquisition_object, '_categories', ()) or base_category_value.getFallbackBaseCategoryList():
if (not acquired_portal_type) or my_acquisition_object.portal_type in acquired_portal_type: if (not acquired_portal_type) or my_acquisition_object.portal_type in acquired_portal_type:
#LOG("Recursive call ",0,str((spec, my_acquisition_object.portal_type))) #LOG("Recursive call ",0,str((spec, my_acquisition_object.portal_type)))
new_result = self.getSingleCategoryAcquiredMembershipList(my_acquisition_object, new_result = self.getSingleCategoryAcquiredMembershipList(my_acquisition_object,
......
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