[Erp5-report] r33440 nicolas.dumazet - /erp5/trunk/products/ERP5/Document/Resource.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Mar 5 12:08:42 CET 2010


Author: nicolas.dumazet
Date: Fri Mar  5 12:08:41 2010
New Revision: 33440

URL: http://svn.erp5.org?rev=33440&view=rev
Log:
Be more careful when playing with context=None

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=33440&r1=33439&r2=33440&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Resource.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Resource.py [utf8] Fri Mar  5 12:08:41 2010
@@ -292,6 +292,10 @@
       If the search returns several candidates due to a relaxed Predicate,
       the first item is returned arbitrarily.
       """
+      method = self._getTypeBasedMethod('getDefaultTransformationValue')
+      if method is not None:
+        return method(context)
+
       if context is None:
         transformation_list = self.portal_catalog(portal_type="Transformation",
                                             resource_category_uid=self.getUid(),
@@ -299,13 +303,9 @@
                                             limit=1)
         if len(transformation_list) > 0:
           return transformation_list[0].getObject()
-
-      else:
-        method = context._getTypeBasedMethod('getDefaultTransformationValue')
-        if method is not None:
-          return method(context)
-
-      method = self._getTypeBasedMethod('getDefaultTransformationValue')
+        return None
+
+      method = context._getTypeBasedMethod('getDefaultTransformationValue')
       if method is not None:
         return method(context)
 




More information about the Erp5-report mailing list