Commit ba59a5b4 authored by Jean-Paul Smets's avatar Jean-Paul Smets

better implementation


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2481 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cdd8b6fd
...@@ -282,26 +282,28 @@ class VariantMovementGroup(RootMovementGroup): ...@@ -282,26 +282,28 @@ class VariantMovementGroup(RootMovementGroup):
allow_class(VariantMovementGroup) allow_class(VariantMovementGroup)
from copy import copy
class CategoryMovementGroup(RootMovementGroup): class CategoryMovementGroup(RootMovementGroup):
"""
This seems to be a useless class
"""
def __init__(self,movement,**kw): def __init__(self,movement,**kw):
RootMovementGroup.__init__(self,movement,**kw) RootMovementGroup.__init__(self,movement,**kw)
self.category_list = movement.getCategoriesList() self.category_list = list(movement.getCategoryList())
if self.category_list is None: if self.category_list is None:
self.category_list = [] self.category_list = []
self.category_list.sort()
def test(self,movement): def test(self,movement):
# we must have the same number of categories # we must have the same number of categories
categories_identity = 0 movement_category_list = list(movement.getCategoryList())
movement_category_list = movement.getCategoriesList()
if movement_category_list is None: if movement_category_list is None:
movement_category_list = [] movement_category_list = []
if len(self.category_list) == len(movement_category_list) : movement_category_list.sort()
for category in movement_category_list : if self.category_list == movement_category_list:
if not category in self.category_list : return 1
break return 0
else :
categories_identity = 1
return categories_identity
allow_class(CategoryMovementGroup) allow_class(CategoryMovementGroup)
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