[Erp5-report] r33314 nicolas.dumazet - /erp5/trunk/products/ERP5/Document/
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Mar 3 10:26:32 CET 2010
Author: nicolas.dumazet
Date: Wed Mar 3 10:26:30 2010
New Revision: 33314
URL: http://svn.erp5.org?rev=33314&view=rev
Log:
getAggregatedAmountList: generated temporary ids must be context-dependent
This fixes an interesting bug:
# Takes place during indexing phase, when Transactional Cache is on
# A transformation is defined, producing a (blue|red) resource from
# (blue|red) fabric
transformation = ...
movement1 = newTempMovement(colour="blue", resource=A)
movement2 = newTempMovement(colour="red", resource=A)
amount1 = transformation.getAggregatedAmountList(movement1)[0]
amount2 = transformation.getAggregatedAmountList(movement2)[0]
# amount1 and amount2 have wrongly the same Physical path.
# Which means that due to caching in CategoryTool, the category
# values will be computed only once instead of twice:
assert amount1.getVariationText() == "colour/blue" #OK
assert amount2.getVariationText() == "colour/blue" # !!
Modified:
erp5/trunk/products/ERP5/Document/TradeModelLine.py
erp5/trunk/products/ERP5/Document/TransformedResource.py
Modified: erp5/trunk/products/ERP5/Document/TradeModelLine.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TradeModelLine.py?rev=33314&r1=33313&r2=33314&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TradeModelLine.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TradeModelLine.py [utf8] Wed Mar 3 10:26:30 2010
@@ -172,7 +172,8 @@
aggregated_amount_list = AggregatedAmountList()
base_application_list = self.getBaseApplicationList()
- self_id = self.getParentValue().getId() + '_' + self.getId()
+ document = self.getParentValue()
+ self_id = '_'.join(document.getId(), self.getId(), context.getId())
# Make tmp movement list only when trade model line is not set to movement level.
tmp_movement_list = []
@@ -185,7 +186,6 @@
update = 1
else:
# get source and destination using Business Process
- document = self.getParentValue()
if getattr(document, 'findSpecialiseValueList', None) is None:
# if parent don't have findSpecialiseValueList, this mean it's on the
# specialise_value
Modified: erp5/trunk/products/ERP5/Document/TransformedResource.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TransformedResource.py?rev=33314&r1=33313&r2=33314&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TransformedResource.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TransformedResource.py [utf8] Wed Mar 3 10:26:30 2010
@@ -181,11 +181,12 @@
# If no predicate is defined on line, the result of the test
# must be true
# Create temporary object to store amount
- # XXX changed by TB getParentID()+getId() instead of getId()
- # This might not be enough if we have different transformation
- # with the same id (for example in several modules)
parent = self.getParentValue()
- tmp_amount = parent.newContent(id=self.getParentId()+'_'+self.getId(),
+ # Be careful: this id must be unique, and change when the context is
+ # changing. Failure to do so exposes to possible erroneous cache hits
+ # for physical path based caching.
+ tmp_id = '_'.join((parent.getId(), self.getId(), context.getId()))
+ tmp_amount = parent.newContent(id=tmp_id,
temp_object=1, portal_type=self.getPortalType())
# Create error string
error_string = ''
More information about the Erp5-report
mailing list