Commit e46756bf authored by Sebastien Robin's avatar Sebastien Robin

rename alt_category by fallback


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1747 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b33d1462
...@@ -836,7 +836,7 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -836,7 +836,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
# Next we look at references # Next we look at references
#LOG("Get Acquired BC",0,base_category_value.getAcquisitionBaseCategoryList()) #LOG("Get Acquired BC",0,base_category_value.getAcquisitionBaseCategoryList())
acquisition_base_category_list = base_category_value.getAcquisitionPortalTypeList() acquisition_base_category_list = base_category_value.getAcquisitionPortalTypeList()
alt_base_category_list = base_category_value.getAcquisitionAltBaseCategoryList() alt_base_category_list = base_category_value.getFallbackBaseCategoryList()
all_acquisition_base_category_list = acquisition_base_category_list + alt_base_category_list all_acquisition_base_category_list = acquisition_base_category_list + alt_base_category_list
acquisition_pt = base_category_value.getAcquisitionPortalTypeList(()) acquisition_pt = base_category_value.getAcquisitionPortalTypeList(())
for my_base_category in base_category_value.getAcquisitionBaseCategoryList(): for my_base_category in base_category_value.getAcquisitionBaseCategoryList():
...@@ -917,9 +917,9 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -917,9 +917,9 @@ class CategoryTool( UniqueObject, Folder, Base ):
# If sync is set, then copy it again # If sync is set, then copy it again
self.setCategoryMembership( context, base_category, result, self.setCategoryMembership( context, base_category, result,
spec=spec, filter=filter, portal_type=portal_type, base=base ) spec=spec, filter=filter, portal_type=portal_type, base=base )
if len(result)==0 and len(base_category_value.getAcquisitionAltBaseCategoryList())>0: if len(result)==0 and len(base_category_value.getFallbackBaseCategoryList())>0:
# We must then try to use the alt base category # We must then try to use the alt base category
for base_category in base_category_value.getAcquisitionAltBaseCategoryList(): for base_category in base_category_value.getFallbackBaseCategoryList():
result += self.getSingleCategoryAcquiredMembershipList( context, base_category, base=base, result += self.getSingleCategoryAcquiredMembershipList( context, base_category, base=base,
spec=spec, filter=filter, acquired_object_dict=acquired_object_dict, **kw ) spec=spec, filter=filter, acquired_object_dict=acquired_object_dict, **kw )
# WE MUST IMPLEMENT HERE THE REST OF THE SEMANTICS # WE MUST IMPLEMENT HERE THE REST OF THE SEMANTICS
......
...@@ -47,8 +47,8 @@ class BaseCategory: ...@@ -47,8 +47,8 @@ class BaseCategory:
'type' : 'lines', 'type' : 'lines',
'default' : [], 'default' : [],
'mode' : 'w' }, 'mode' : 'w' },
{ 'id' : 'acquisition_alt_base_category', { 'id' : 'fallback_base_category',
'description' : 'Alternate base categories to acquire value from if everything else fails', 'description' : 'another base category to get if everything else fails',
'type' : 'tokens', 'type' : 'tokens',
'default' : [], 'default' : [],
'mode' : 'w' }, 'mode' : 'w' },
......
...@@ -133,7 +133,7 @@ class TestCMFCategory(ERP5TypeTestCase): ...@@ -133,7 +133,7 @@ class TestCMFCategory(ERP5TypeTestCase):
portal_categories[bc].setAcquisitionCopyValue(0) portal_categories[bc].setAcquisitionCopyValue(0)
portal_categories[bc].setAcquisitionAppendValue(0) portal_categories[bc].setAcquisitionAppendValue(0)
portal_categories[bc].setAcquisitionSyncValue(1) portal_categories[bc].setAcquisitionSyncValue(1)
portal_categories[bc].setAcquisitionAltBaseCategoryList(['subordination']) portal_categories[bc].setFallbackBaseCategoryList(['subordination'])
def login(self, quiet=0, run=run_all_test): def login(self, quiet=0, run=run_all_test):
uf = self.getPortal().acl_users uf = self.getPortal().acl_users
...@@ -287,12 +287,12 @@ class TestCMFCategory(ERP5TypeTestCase): ...@@ -287,12 +287,12 @@ class TestCMFCategory(ERP5TypeTestCase):
parent_uid_list2.sort() parent_uid_list2.sort()
self.assertEqual(parent_uid_list2, parent_uid_list) self.assertEqual(parent_uid_list2, parent_uid_list)
def test_10_AltBaseCategory(self, quiet=0, run=run_all_test): def test_10_FallBackBaseCategory(self, quiet=0, run=run_all_test):
# Test if we can use an alternative base category # Test if we can use an alternative base category
if not run: return if not run: return
if not quiet: if not quiet:
ZopeTestCase._print('\n Test Alt Base Category ') ZopeTestCase._print('\n Test Fallback Base Category ')
LOG('Testing... ',0,'testAltBaseCategory') LOG('Testing... ',0,'testFallbackBaseCategory')
portal = self.getPortal() portal = self.getPortal()
p1 = self.getPersonModule()._getOb(self.id1) p1 = self.getPersonModule()._getOb(self.id1)
p2 = self.getPersonModule()._getOb(self.id2) p2 = self.getPersonModule()._getOb(self.id2)
......
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