From 8d13a6f9bdb1a15e780a31682997487380e665ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com> Date: Tue, 16 Jun 2009 12:55:30 +0000 Subject: [PATCH] - set proper security for updateAggregatedAmountList - it will modify context, not self, so ACI is enough - simplify loop into list operation - move parameter initialisation to top git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27603 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/TradeCondition.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/product/ERP5/Document/TradeCondition.py b/product/ERP5/Document/TradeCondition.py index b7f14a2ffc..7d0705d42b 100644 --- a/product/ERP5/Document/TradeCondition.py +++ b/product/ERP5/Document/TradeCondition.py @@ -79,7 +79,7 @@ class TradeCondition(Path, Transformation, XMLMatrix): zope.interface.implements(interfaces.ITransformation) - security.declareProtected(Permissions.ModifyPortalContent, + security.declareProtected(Permissions.AccessContentsInformation, 'updateAggregatedAmountList') def updateAggregatedAmountList(self, context, **kw): existing_movement_list = context.getMovementList() @@ -212,14 +212,14 @@ class TradeCondition(Path, Transformation, XMLMatrix): security.declareProtected(Permissions.AccessContentsInformation, 'getAggregatedAmountList') def getAggregatedAmountList(self, context, movement_list=None, **kw): + if movement_list is None: + movement_list = [] result = AggregatedAmountList() trade_model_line_composed_list = \ self.getTradeModelLineComposedList(context) need_to_run = 1 - if movement_list is None: - movement_list = [] while need_to_run: need_to_run = 0 for model_line in trade_model_line_composed_list: @@ -234,11 +234,8 @@ class TradeCondition(Path, Transformation, XMLMatrix): movement_list = result # remove movement that should not be created - final_list = [] - for movement in result: - if movement.getCausalityValue().getCreateLine(): - final_list.append(movement) - return final_list + result = [movement for movement in result if movement.getCausalityValue().getCreateLine()] + return result security.declareProtected( Permissions.AccessContentsInformation, 'getCell') def getCell(self, *kw , **kwd): -- 2.30.9