[Erp5-report] r25608 - /erp5/trunk/products/ERP5/Document/BudgetCell.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Feb 18 16:00:58 CET 2009
Author: jerome
Date: Wed Feb 18 16:00:53 2009
New Revision: 25608
URL: http://svn.erp5.org?rev=25608&view=rev
Log:
Don't assume that an UnboundLocalError means that the type based script is not
found, simply check if _getTypeBasedMethod returns None
Modified:
erp5/trunk/products/ERP5/Document/BudgetCell.py
Modified: erp5/trunk/products/ERP5/Document/BudgetCell.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BudgetCell.py?rev=25608&r1=25607&r2=25608&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BudgetCell.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BudgetCell.py [utf8] Wed Feb 18 16:00:53 2009
@@ -76,13 +76,11 @@
Return a calculated title.
"""
script = self._getTypeBasedMethod('asTitle')
- try:
- title = script()
- except UnboundLocalError:
- raise UnboundLocalError,\
+ if script is not None:
+ return script()
+ raise UnboundLocalError,\
"Did not find title script for portal type: %r" %\
self.getPortalType()
- return title
security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventory')
def getCurrentInventory(self, **kw):
@@ -108,13 +106,11 @@
Return consumed budget.
"""
script = self._getTypeBasedMethod('getConsumedBudget')
- try:
- result = script(src__=src__)
- except UnboundLocalError:
- raise UnboundLocalError,\
+ if script is not None:
+ return script(src__=src__)
+ raise UnboundLocalError,\
"Did not find consumed budget script for portal type: %r" % \
self.getPortalType()
- return result
security.declareProtected(Permissions.AccessContentsInformation, 'getAvailableBudget')
def getAvailableBudget(self):
@@ -129,11 +125,9 @@
Return Engaged budget.
"""
script = self._getTypeBasedMethod('getEngagedBudget')
- try:
- result = script(src__=src__)
- except UnboundLocalError:
- raise UnboundLocalError,\
+ if script is not None:
+ return script(src__=src__)
+ raise UnboundLocalError,\
"Did not find engaged budget script for portal type: %r" % \
self.getPortalType()
- return result
More information about the Erp5-report
mailing list