[Erp5-report] r37016 nicolas - /erp5/trunk/products/ERP5/Tool/ContributionTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jul 9 15:02:24 CEST 2010


Author: nicolas
Date: Fri Jul  9 15:02:22 2010
New Revision: 37016

URL: http://svn.erp5.org?rev=37016&view=rev
Log:
Fix usage of default parameter

Modified:
    erp5/trunk/products/ERP5/Tool/ContributionTool.py

Modified: erp5/trunk/products/ERP5/Tool/ContributionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/ContributionTool.py?rev=37016&r1=37015&r2=37016&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/ContributionTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Tool/ContributionTool.py [utf8] Fri Jul  9 15:02:22 2010
@@ -414,8 +414,13 @@ class ContributionTool(BaseTool):
     # when
     #   o = folder._getOb(id)
     # was called in DocumentConstructor
-    result = BaseTool._getOb(self, id, default=default)
-    if result is not _marker:
+    if default is _marker:
+      result = BaseTool._getOb(self, id)
+    else:
+      result = BaseTool._getOb(self, id, default=default)
+    if result is not None:
+      # if result is None, ignore it at this stage
+      # we can be more lucky with portal_catalog
       return result
 
     # Return an object listed by listDAVObjects
@@ -423,7 +428,8 @@ class ContributionTool(BaseTool):
     object = self.getPortalObject().portal_catalog.unrestrictedGetResultValue(uid=uid)
     if object is not None:
       return object.getObject() # Make sure this does not break security. XXX
-
+    if default is not _marker:
+      return default
     # Raise an AttributeError the same way as in OFS.ObjectManager._getOb
     raise AttributeError, id
 




More information about the Erp5-report mailing list