From 337369e8f486509b3c990b6eafdab99b3b9d328b Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Wed, 18 Aug 2010 11:47:21 +0000 Subject: [PATCH] style git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@37883 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/ExplanationCache.py | 4 ++-- product/ERP5/mixin/builder.py | 34 ++++++++++++-------------------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/product/ERP5/ExplanationCache.py b/product/ERP5/ExplanationCache.py index 555b671120..63418fd01e 100644 --- a/product/ERP5/ExplanationCache.py +++ b/product/ERP5/ExplanationCache.py @@ -256,8 +256,8 @@ class ExplanationCache: path_list = self.getSimulationPathPatternList() path_list = map(lambda x:x[0:-1], path_list) # Remove trailing % path_set = set() - for simulation_movement in business_link.\ - _getExplanationRelatedSimulationMovementValueList(self.explanation): + for simulation_movement in \ + self.getBusinessLinkRelatedSimulationMovementValueList(business_link): simulation_path = simulation_movement.getPath() for path in path_list: if simulation_path.startswith(path): diff --git a/product/ERP5/mixin/builder.py b/product/ERP5/mixin/builder.py index b0d72a3143..b7311b2d5f 100644 --- a/product/ERP5/mixin/builder.py +++ b/product/ERP5/mixin/builder.py @@ -112,40 +112,32 @@ class BuilderMixin(XMLObject, Amount, Predicate): or to Simulation Movements related to a limited set of existing """ # Parameter initialization - if movement_relative_url_list is None: - movement_relative_url_list = [] if delivery_relative_url_list is None: delivery_relative_url_list = [] - if movement_list is None: - movement_list = [] # Call a script before building self.callBeforeBuildingScript() # XXX-JPS Used ? # Select - if not len(movement_list): - if len(movement_relative_url_list) == 0: + if not movement_list: + if movement_relative_url_list: + movement_list = map(self.restrictedTraverse, + movement_relative_url_list) + else: if explanation is not None: explanation_cache = _getExplanationCache(explanation) - path = explanation_cache.getSimulationPathPatternList() - else: - path = kw.get('path', None) + kw['path'] = explanation_cache.getSimulationPathPatternList() if business_link is not None: - causality_uid = business_link.getUid() - else: - causality_uid = kw.get('causality_uid', None) - kw.update(dict(causality_uid=causality_uid, path=path)) - if kw.get('causality_uid') is None: + kw['causality_uid'] = business_link.getUid() + elif kw.get('causality_uid') is None: business_link_value_list = self.getRelatedBusinessLinkValueList() if len(business_link_value_list) > 0: # use only Business Link related movements kw['causality_uid'] = [link_value.getUid() for link_value in business_link_value_list] movement_list = self.searchMovementList( - delivery_relative_url_list=delivery_relative_url_list, - applied_rule_uid=applied_rule_uid,**kw) - else: - movement_list = [self.restrictedTraverse(relative_url) for relative_url \ - in movement_relative_url_list] - if not len(movement_list): - return [] + delivery_relative_url_list=delivery_relative_url_list, + applied_rule_uid=applied_rule_uid, + **kw) + if not movement_list: + return [] # Collect root_group_node = self.collectMovement(movement_list) # Build -- 2.30.9