Commit 3566dfcb authored by Łukasz Nowak's avatar Łukasz Nowak

- use `document' variable instead of python reserved `object'


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26470 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9c6343e0
...@@ -44,6 +44,6 @@ class BaseVariantMovementGroup(MovementGroup): ...@@ -44,6 +44,6 @@ class BaseVariantMovementGroup(MovementGroup):
property_dict['_base_category_list'] = category_list property_dict['_base_category_list'] = category_list
return property_dict return property_dict
def test(self, object, property_dict, **kw): def test(self, document, property_dict, **kw):
# This movement group does not affect updating. # This movement group does not affect updating.
return True, {} return True, {}
...@@ -45,7 +45,7 @@ class CategoryMovementGroup(PropertyMovementGroup): ...@@ -45,7 +45,7 @@ class CategoryMovementGroup(PropertyMovementGroup):
movement.getPropertyList(prop, None)) movement.getPropertyList(prop, None))
return property_dict return property_dict
def test(self, object, property_dict, property_list=None, **kw): def test(self, document, property_dict, property_list=None, **kw):
if property_list not in (None, []): if property_list not in (None, []):
target_property_list = [x for x in self.getTestedPropertyList() \ target_property_list = [x for x in self.getTestedPropertyList() \
if x in property_list] if x in property_list]
...@@ -53,6 +53,6 @@ class CategoryMovementGroup(PropertyMovementGroup): ...@@ -53,6 +53,6 @@ class CategoryMovementGroup(PropertyMovementGroup):
target_property_list = self.getTestedPropertyList() target_property_list = self.getTestedPropertyList()
for prop in target_property_list: for prop in target_property_list:
if property_dict['%s_list' % prop] != \ if property_dict['%s_list' % prop] != \
sorted(object.getPropertyList(prop, None)): sorted(document.getPropertyList(prop, None)):
return False, property_dict return False, property_dict
return True, property_dict return True, property_dict
...@@ -43,10 +43,10 @@ class DayMovementGroup(MovementGroup): ...@@ -43,10 +43,10 @@ class DayMovementGroup(MovementGroup):
property_dict['stop_date'] = addToDate(start_date, day=1) property_dict['stop_date'] = addToDate(start_date, day=1)
return property_dict return property_dict
def test(self, object, property_dict, **kw): def test(self, document, property_dict, **kw):
start_date = property_dict['start_date'] start_date = property_dict['start_date']
stop_date = property_dict['stop_date'] stop_date = property_dict['stop_date']
if object.getStartDate() <= start_date < stop_date <= object.getStopDate(): if document.getStartDate() <= start_date < stop_date <= document.getStopDate():
return True, property_dict return True, property_dict
else: else:
return False, property_dict return False, property_dict
......
...@@ -52,14 +52,14 @@ class MonthlyRangeMovementGroup(MovementGroup): ...@@ -52,14 +52,14 @@ class MonthlyRangeMovementGroup(MovementGroup):
property_dict[property_name] = end_of_month property_dict[property_name] = end_of_month
return property_dict return property_dict
def test(self, object, property_dict, property_list=None, **kw): def test(self, document, property_dict, property_list=None, **kw):
start_date = property_dict.get('start_date', None) start_date = property_dict.get('start_date', None)
stop_date = property_dict.get('stop_date', None) stop_date = property_dict.get('stop_date', None)
if start_date is None or stop_date is None: if start_date is None or stop_date is None:
return False, property_dict return False, property_dict
target_start_date = object.getProperty('start_date', None) target_start_date = document.getProperty('start_date', None)
target_stop_date = object.getProperty('stop_date', None) target_stop_date = document.getProperty('stop_date', None)
if target_start_date is None or target_stop_date is None: if target_start_date is None or target_stop_date is None:
return False, property_dict return False, property_dict
......
...@@ -54,7 +54,7 @@ class MovementGroup(XMLObject): ...@@ -54,7 +54,7 @@ class MovementGroup(XMLObject):
# This method should be defined in sub classes. # This method should be defined in sub classes.
raise NotImplementedError raise NotImplementedError
def test(self, object, property_dict, **kw): def test(self, document, property_dict, **kw):
# This method should be defined in sub classes. # This method should be defined in sub classes.
raise NotImplementedError raise NotImplementedError
......
...@@ -39,14 +39,14 @@ class NestedLineMovementGroup(MovementGroup): ...@@ -39,14 +39,14 @@ class NestedLineMovementGroup(MovementGroup):
def _getPropertyDict(self, movement, **kw): def _getPropertyDict(self, movement, **kw):
return {} return {}
def test(self, object, property_dict, property_list=None, **kw): def test(self, document, property_dict, property_list=None, **kw):
if property_list not in (None, []): if property_list not in (None, []):
target_property_list = [x for x in self.getTestedPropertyList() \ target_property_list = [x for x in self.getTestedPropertyList() \
if x in property_list] if x in property_list]
else: else:
target_property_list = self.getTestedPropertyList() target_property_list = self.getTestedPropertyList()
for prop in target_property_list: for prop in target_property_list:
if property_dict[prop] != object.getProperty(prop, None): if property_dict[prop] != document.getProperty(prop, None):
return False, property_dict return False, property_dict
return True, property_dict return True, property_dict
......
...@@ -45,8 +45,8 @@ class ParentExplanationMovementGroup(MovementGroup): ...@@ -45,8 +45,8 @@ class ParentExplanationMovementGroup(MovementGroup):
property_dict['parent_explanation_value'] = parent_explanation_value property_dict['parent_explanation_value'] = parent_explanation_value
return property_dict return property_dict
def test(self, object, property_dict, **kw): def test(self, document, property_dict, **kw):
if object.getParentExplanationValue() == \ if document.getParentExplanationValue() == \
property_dict['parent_explanation_value']: property_dict['parent_explanation_value']:
return True, property_dict return True, property_dict
else: else:
......
...@@ -44,13 +44,13 @@ class PropertyMovementGroup(MovementGroup): ...@@ -44,13 +44,13 @@ class PropertyMovementGroup(MovementGroup):
property_dict[prop] = movement.getProperty(prop, None) property_dict[prop] = movement.getProperty(prop, None)
return property_dict return property_dict
def test(self, object, property_dict, property_list=None, **kw): def test(self, document, property_dict, property_list=None, **kw):
if property_list not in (None, []): if property_list not in (None, []):
target_property_list = [x for x in self.getTestedPropertyList() \ target_property_list = [x for x in self.getTestedPropertyList() \
if x in property_list] if x in property_list]
else: else:
target_property_list = self.getTestedPropertyList() target_property_list = self.getTestedPropertyList()
for prop in target_property_list: for prop in target_property_list:
if property_dict[prop] != object.getProperty(prop, None): if property_dict[prop] != document.getProperty(prop, None):
return False, property_dict return False, property_dict
return True, property_dict return True, property_dict
...@@ -84,8 +84,8 @@ class QuantitySignMovementGroup(MovementGroup): ...@@ -84,8 +84,8 @@ class QuantitySignMovementGroup(MovementGroup):
[tmp_list[0], {'quantity_sign':0}], [tmp_list[0], {'quantity_sign':0}],
] ]
def test(self, object, property_dict, **kw): def test(self, document, property_dict, **kw):
if object.getQuantitySign() == property_dict['quantity_sign']: if document.getQuantitySign() == property_dict['quantity_sign']:
return True, property_dict return True, property_dict
else: else:
return False, property_dict return False, property_dict
...@@ -38,7 +38,7 @@ class SplitMovementGroup(MovementGroup): ...@@ -38,7 +38,7 @@ class SplitMovementGroup(MovementGroup):
def _getPropertyDict(self, movement, **kw): def _getPropertyDict(self, movement, **kw):
return {} return {}
def test(self, object, property_dict, **kw): def test(self, document, property_dict, **kw):
return True, property_dict return True, property_dict
def _separate(self, movement_list): def _separate(self, movement_list):
......
...@@ -40,8 +40,8 @@ class TitleMovementGroup(MovementGroup): ...@@ -40,8 +40,8 @@ class TitleMovementGroup(MovementGroup):
property_dict['title'] = self._getTitle(movement) property_dict['title'] = self._getTitle(movement)
return property_dict return property_dict
def test(self, object, property_dict, **kw): def test(self, document, property_dict, **kw):
# If title is different, we want to update existing object instead # If title is different, we want to update existing document instead
# of creating a new one. # of creating a new one.
return True, property_dict return True, property_dict
......
...@@ -44,8 +44,8 @@ class VariantMovementGroup(MovementGroup): ...@@ -44,8 +44,8 @@ class VariantMovementGroup(MovementGroup):
property_dict['variation_category_list'] = category_list property_dict['variation_category_list'] = category_list
return property_dict return property_dict
def test(self, object, property_dict, **kw): def test(self, document, property_dict, **kw):
category_list = object.getVariationCategoryList() category_list = document.getVariationCategoryList()
if category_list is None: if category_list is None:
category_list = [] category_list = []
category_list.sort() category_list.sort()
......
...@@ -41,9 +41,9 @@ class VariationPropertyMovementGroup(MovementGroup): ...@@ -41,9 +41,9 @@ class VariationPropertyMovementGroup(MovementGroup):
def _getPropertyDict(self, movement, **kw): def _getPropertyDict(self, movement, **kw):
return {'variation_property_dict':movement.getVariationPropertyDict()} return {'variation_property_dict':movement.getVariationPropertyDict()}
def test(self, object, property_dict, **kw): def test(self, document, property_dict, **kw):
updatable = False updatable = False
variation_property_dict = object.getVariationPropertyDict() variation_property_dict = document.getVariationPropertyDict()
variation_property_list = variation_property_dict.keys() variation_property_list = variation_property_dict.keys()
if len(variation_property_list) == \ if len(variation_property_list) == \
len(property_dict['variation_property_dict']): len(property_dict['variation_property_dict']):
......
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