Commit 496b7f84 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Specify a default value to base_category_list in getRelatedValueList.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1495 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d459963e
......@@ -685,6 +685,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
if spec is (): spec = portal_type
# We must treat parent in a different way
#LOG('getSingleCategoryMembershipList', 0, 'base_category = %s, spec = %s, base = %s, context = %s, context.aq_parent = %s' % (repr(base_category), repr(spec), repr(base), repr(context), repr(context.aq_parent)))
if base_category == 'parent':
parent = context.aq_parent # aq_inner ?
if parent.portal_type in spec:
......@@ -692,6 +693,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
return ['parent/' + parent.getRelativeUrl()]
else:
return [parent.getRelativeUrl()]
#LOG('getSingleCategoryMembershipList', 0, 'not in spec: parent.portal_type = %s, spec = %s' % (repr(parent.portal_type), repr(spec)))
return []
result = []
......@@ -801,6 +803,8 @@ class CategoryTool( UniqueObject, Folder, Base ):
spec=spec, filter=filter, **kw )
base_category_value = self.getCategoryValue(base_category)
# LOG("base_category_value",0,str(base_category_value))
# LOG("result",0,str(result))
if base_category_value is not None:
# If we do not mask or append, return now if not empty
if base_category_value.getAcquisitionMaskValue() and \
......@@ -896,7 +900,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
# If acquisition appends, then we must append to the result
result += new_result
elif len(new_result) > 0:
LOG("new_result ",0,str(new_result))
#LOG("new_result ",0,str(new_result))
if (base_category_value.acquisition_copy_value and len(original_result) == 0) \
or base_category_value.acquisition_sync_value:
# If copy is set and result was empty, then copy it once
......@@ -937,11 +941,11 @@ class CategoryTool( UniqueObject, Folder, Base ):
base_category_list = [base_category]
else:
base_category_list = base_category
LOG('CT.getAcquiredCategoryMembershipList result',0,result)
#LOG('CT.getAcquiredCategoryMembershipList result',0,result)
for base_category in base_category_list:
result += self.getSingleCategoryAcquiredMembershipList(context, base_category, base=base,
spec=spec, filter=filter, acquired_object_dict=acquired_object_dict, **kw )
LOG('CT.getAcquiredCategoryMembershipList new result',0,result)
#LOG('CT.getAcquiredCategoryMembershipList new result',0,result)
return result
security.declareProtected( Permissions.AccessContentsInformation, 'isMemberOf' )
......@@ -1114,8 +1118,8 @@ class CategoryTool( UniqueObject, Folder, Base ):
new_category_url,'\g<start>/%s' % previous_category_url, new_o_category_url)
self.updateRelatedContent(o, previous_o_category_url, new_o_category_url)
security.declareProtected( Permissions.ModifyPortalContent, 'getRelatedValueList' )
def getRelatedValueList(self, context, base_category_list,
security.declareProtected( Permissions.AccessContentsInformation, 'getRelatedValueList' )
def getRelatedValueList(self, context, base_category_list=None,
spec=(), filter=None, base=1, **kw):
#LOG('getRelatedValueList',0,'base_category_list: %s, filter: %s, kw: %s' %
# (str(base_category_list),str(filter),str(kw)))
......
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