[Erp5-report] r33350 nicolas.dumazet - /erp5/trunk/products/ERP5/Document/Resource.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Mar 4 04:52:55 CET 2010
Author: nicolas.dumazet
Date: Thu Mar 4 04:52:55 2010
New Revision: 33350
URL: http://svn.erp5.org?rev=33350&view=rev
Log:
* Return the latest version if there are several candidates
* limit query results as we only use one item
* so long for infinite recursion
Modified:
erp5/trunk/products/ERP5/Document/Resource.py
Modified: erp5/trunk/products/ERP5/Document/Resource.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Resource.py?rev=33350&r1=33349&r2=33350&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Resource.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Resource.py [utf8] Thu Mar 4 04:52:55 2010
@@ -285,7 +285,8 @@
def getDefaultTransformationValue(self, context=None):
"""
If context is None, returns the first available transformation that
- use self as a Resource.
+ use self as a Resource. If there are several candidates, return the
+ Transformation that has the latest version.
Otherwise, context is used as a Predicate to match Transformations.
If the search returns several candidates due to a relaxed Predicate,
@@ -293,7 +294,9 @@
"""
if context is None:
transformation_list = self.portal_catalog(portal_type="Transformation",
- resource_category_uid=self.getUid())
+ resource_category_uid=self.getUid(),
+ sort_on=[('version', 'descending')],
+ limit=1)
if len(transformation_list) > 0:
return transformation_list[0].getObject()
@@ -305,7 +308,8 @@
return method(context)
transformation_list = self.portal_domains.searchPredicateList(context,
- portal_type="Transformation")
+ portal_type="Transformation",
+ limit=1)
if len(transformation_list) > 0:
return transformation_list[0]
@@ -330,7 +334,7 @@
if method is not None:
return method()
- return self.getDefaultConversionTransformationValue(context=None)
+ return self.getDefaultTransformationValue(context=None)
####################################################
More information about the Erp5-report
mailing list