Commit 66e40917 authored by Jérome Perrin's avatar Jérome Perrin

Remove some commented out logs.

Simplify test methods implementations.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7264 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6a65ecd3
...@@ -29,11 +29,9 @@ ...@@ -29,11 +29,9 @@
############################################################################## ##############################################################################
""" """
Define in this class all classes intended to group every kind of movement Define in this file all classes intended to group every kind of movement
""" """
from AccessControl import ClassSecurityInfo
from Globals import InitializeClass, DTMLFile
from zLOG import LOG from zLOG import LOG
from Products.PythonScripts.Utility import allow_class from Products.PythonScripts.Utility import allow_class
...@@ -127,10 +125,7 @@ class RootMovementGroup: ...@@ -127,10 +125,7 @@ class RootMovementGroup:
""" """
Get property dict for the futur created object Get property dict for the futur created object
""" """
if hasattr(self, '_property_dict'): return getattr(self, '_property_dict', {})
return self._property_dict
else:
return {}
def getMovementList(self): def getMovementList(self):
""" """
...@@ -259,14 +254,10 @@ class OrderMovementGroup(RootMovementGroup): ...@@ -259,14 +254,10 @@ class OrderMovementGroup(RootMovementGroup):
# get the id of the enclosing delivery # get the id of the enclosing delivery
# for this cell or line # for this cell or line
order_relative_url = order_value.getRelativeUrl() order_relative_url = order_value.getRelativeUrl()
if order_relative_url == self.order: return order_relative_url == self.order
return 1
else :
return 0
allow_class(OrderMovementGroup) allow_class(OrderMovementGroup)
class CausalityMovementGroup(RootMovementGroup): class CausalityMovementGroup(RootMovementGroup):
""" Groups movement that comes from simulation movement that shares the """ Groups movement that comes from simulation movement that shares the
same explanation relation. For example, it groups in an Invoice same explanation relation. For example, it groups in an Invoice
...@@ -315,7 +306,8 @@ class RootAppliedRuleCausalityMovementGroup(RootMovementGroup): ...@@ -315,7 +306,8 @@ class RootAppliedRuleCausalityMovementGroup(RootMovementGroup):
RootMovementGroup.__init__(self, movement=movement, **kw) RootMovementGroup.__init__(self, movement=movement, **kw)
explanation_relative_url = self._getExplanationRelativeUrl(movement) explanation_relative_url = self._getExplanationRelativeUrl(movement)
self.explanation = explanation_relative_url self.explanation = explanation_relative_url
explanation_value = movement.getPortalObject().restrictedTraverse(explanation_relative_url) explanation_value = movement.getPortalObject().restrictedTraverse(
explanation_relative_url)
self.setGroupEdit( self.setGroupEdit(
root_causality_value_list = [explanation_value] root_causality_value_list = [explanation_value]
) )
...@@ -493,18 +485,15 @@ allow_class(CriterionMovementGroup) ...@@ -493,18 +485,15 @@ allow_class(CriterionMovementGroup)
class ResourceMovementGroup(RootMovementGroup): class ResourceMovementGroup(RootMovementGroup):
def __init__(self,movement,**kw): def __init__(self, movement, **kw):
RootMovementGroup.__init__(self, movement=movement, **kw) RootMovementGroup.__init__(self, movement=movement, **kw)
self.resource = movement.getResource() self.resource = movement.getResource()
self.setGroupEdit( self.setGroupEdit(
resource_value=movement.getResourceValue() resource_value=movement.getResourceValue()
) )
def test(self,movement): def test(self, movement):
if movement.getResource() == self.resource : return movement.getResource() == self.resource
return 1
else :
return 0
allow_class(ResourceMovementGroup) allow_class(ResourceMovementGroup)
...@@ -514,16 +503,13 @@ class BaseVariantMovementGroup(RootMovementGroup): ...@@ -514,16 +503,13 @@ class BaseVariantMovementGroup(RootMovementGroup):
RootMovementGroup.__init__(self, movement=movement, **kw) RootMovementGroup.__init__(self, movement=movement, **kw)
self.base_category_list = movement.getVariationBaseCategoryList() self.base_category_list = movement.getVariationBaseCategoryList()
if self.base_category_list is None: if self.base_category_list is None:
#LOG('BaseVariantGroup __init__', 0, 'movement = %s, movement.showDict() = %s' % (repr(movement), repr(movement.showDict())))
self.base_category_list = [] self.base_category_list = []
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 categories_identity = 0
#LOG('BaseVariantGroup', 0, 'self.base_category_list = %s, movement = %s, movement.getVariationBaseCategoryList() = %s' % (repr(self.base_category_list), repr(movement), repr(movement.getVariationBaseCategoryList())))
movement_base_category_list = movement.getVariationBaseCategoryList() movement_base_category_list = movement.getVariationBaseCategoryList()
if movement_base_category_list is None: if movement_base_category_list is None:
#LOG('BaseVariantGroup test', 0, 'movement = %s, movement.showDict() = %s' % (repr(movement), repr(movement.showDict())))
movement_base_category_list = [] movement_base_category_list = []
if len(self.base_category_list) == len(movement_base_category_list): if len(self.base_category_list) == len(movement_base_category_list):
for category in movement_base_category_list: for category in movement_base_category_list:
...@@ -541,7 +527,6 @@ class VariantMovementGroup(RootMovementGroup): ...@@ -541,7 +527,6 @@ class VariantMovementGroup(RootMovementGroup):
RootMovementGroup.__init__(self, movement=movement, **kw) RootMovementGroup.__init__(self, movement=movement, **kw)
self.category_list = movement.getVariationCategoryList() self.category_list = movement.getVariationCategoryList()
if self.category_list is None: if self.category_list is None:
#LOG('VariantGroup __init__', 0, 'movement = %s, movement.showDict() = %s' % (repr(movement), repr(movement.showDict())))
self.category_list = [] self.category_list = []
self.setGroupEdit( self.setGroupEdit(
variation_category_list=self.category_list variation_category_list=self.category_list
...@@ -552,7 +537,6 @@ class VariantMovementGroup(RootMovementGroup): ...@@ -552,7 +537,6 @@ class VariantMovementGroup(RootMovementGroup):
categories_identity = 0 categories_identity = 0
movement_category_list = movement.getVariationCategoryList() movement_category_list = movement.getVariationCategoryList()
if movement_category_list is None: if movement_category_list is None:
#LOG('VariantGroup test', 0, 'movement = %s, movement.showDict() = %s' % (repr(movement), repr(movement.showDict())))
movement_category_list = [] movement_category_list = []
if len(self.category_list) == len(movement_category_list): if len(self.category_list) == len(movement_category_list):
for category in movement_category_list: for category in movement_category_list:
...@@ -564,8 +548,6 @@ class VariantMovementGroup(RootMovementGroup): ...@@ -564,8 +548,6 @@ 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 This seems to be a useless class
...@@ -594,8 +576,8 @@ class OptionMovementGroup(RootMovementGroup): ...@@ -594,8 +576,8 @@ class OptionMovementGroup(RootMovementGroup):
def __init__(self,movement,**kw): def __init__(self,movement,**kw):
RootMovementGroup.__init__(self, movement=movement, **kw) RootMovementGroup.__init__(self, movement=movement, **kw)
option_base_category_list = movement.getPortalOptionBaseCategoryList() option_base_category_list = movement.getPortalOptionBaseCategoryList()
self.option_category_list = movement.getVariationCategoryList(base_category_list=option_base_category_list) self.option_category_list = movement.getVariationCategoryList(
#LOG('OptionMovementGroup.__init__, option_category_list',0,self.option_category_list) base_category_list=option_base_category_list)
if self.option_category_list is None: if self.option_category_list is None:
self.option_category_list = [] self.option_category_list = []
# XXX This is very bad, but no choice today. # XXX This is very bad, but no choice today.
...@@ -605,8 +587,8 @@ class OptionMovementGroup(RootMovementGroup): ...@@ -605,8 +587,8 @@ class OptionMovementGroup(RootMovementGroup):
# we must have the same number of categories # we must have the same number of categories
categories_identity = 0 categories_identity = 0
option_base_category_list = movement.getPortalOptionBaseCategoryList() option_base_category_list = movement.getPortalOptionBaseCategoryList()
movement_option_category_list = movement.getVariationCategoryList(base_category_list=option_base_category_list) movement_option_category_list = movement.getVariationCategoryList(
#LOG('OptionMovementGroup.test, option_category_list',0,movement_option_category_list) base_category_list=option_base_category_list)
if movement_option_category_list is None: if movement_option_category_list is None:
movement_option_category_list = [] movement_option_category_list = []
if len(self.option_category_list) == len(movement_option_category_list): if len(self.option_category_list) == len(movement_option_category_list):
...@@ -664,6 +646,7 @@ class FakeMovement: ...@@ -664,6 +646,7 @@ class FakeMovement:
by DeliveryBuilder. by DeliveryBuilder.
It contents a list a real ERP5 Movement and can modify them. It contents a list a real ERP5 Movement and can modify them.
""" """
def __init__(self, movement_list): def __init__(self, movement_list):
""" """
Create a fake movement and store the list of real movement Create a fake movement and store the list of real movement
...@@ -870,7 +853,7 @@ class FakeMovement: ...@@ -870,7 +853,7 @@ class FakeMovement:
self.setDeliveryValue(kw[key]) self.setDeliveryValue(kw[key])
else: else:
raise FakeMovementError,\ raise FakeMovementError,\
"Could not call edit on Fakeovement with parameters: %r" % key "Could not call edit on Fakemovement with parameters: %r" % key
class TitleMovementGroup(RootMovementGroup): class TitleMovementGroup(RootMovementGroup):
...@@ -893,10 +876,7 @@ class TitleMovementGroup(RootMovementGroup): ...@@ -893,10 +876,7 @@ class TitleMovementGroup(RootMovementGroup):
) )
def test(self,movement): def test(self,movement):
if self.getTitle(movement) == self.title : return self.getTitle(movement) == self.title
return 1
else :
return 0
# XXX This should not be here # XXX This should not be here
# I (seb) have commited this because movement groups are not # I (seb) have commited this because movement groups are not
...@@ -922,10 +902,7 @@ class IntIndexMovementGroup(RootMovementGroup): ...@@ -922,10 +902,7 @@ class IntIndexMovementGroup(RootMovementGroup):
) )
def test(self,movement): def test(self,movement):
if self.getIntIndex(movement) == self.int_index : return self.getIntIndex(movement) == self.int_index
return 1
else :
return 0
allow_class(IntIndexMovementGroup) allow_class(IntIndexMovementGroup)
...@@ -946,10 +923,7 @@ class DecisionMovementGroup(RootMovementGroup): ...@@ -946,10 +923,7 @@ class DecisionMovementGroup(RootMovementGroup):
) )
def test(self,movement): def test(self,movement):
if self.getDecision(movement) == self.decision : return self.getDecision(movement) == self.decision
return 1
else :
return 0
allow_class(DecisionMovementGroup) allow_class(DecisionMovementGroup)
...@@ -970,10 +944,7 @@ class BrandMovementGroup(RootMovementGroup): ...@@ -970,10 +944,7 @@ class BrandMovementGroup(RootMovementGroup):
) )
def test(self,movement): def test(self,movement):
if self.getBrand(movement) == self.brand : return self.getBrand(movement) == self.brand
return 1
else :
return 0
allow_class(BrandMovementGroup) allow_class(BrandMovementGroup)
......
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