[Erp5-report] r16777 - /erp5/trunk/products/ERP5Form/SelectionTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Oct 2 15:41:43 CEST 2007
Author: nicolas
Date: Tue Oct 2 15:41:42 2007
New Revision: 16777
URL: http://svn.erp5.org?rev=16777&view=rev
Log:
Do not using List as default parameter
Modified:
erp5/trunk/products/ERP5Form/SelectionTool.py
Modified: erp5/trunk/products/ERP5Form/SelectionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/SelectionTool.py?rev=16777&r1=16776&r2=16777&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/SelectionTool.py (original)
+++ erp5/trunk/products/ERP5Form/SelectionTool.py Tue Oct 2 15:41:42 2007
@@ -56,6 +56,8 @@
from Products.ERP5Type.Message import Message
import warnings
+_MARKER = []
+
class SelectionError( Exception ):
pass
@@ -483,18 +485,18 @@
selection.edit(stats=stats)
security.declareProtected(ERP5Permissions.View, 'getSelectionStats')
- def getSelectionStats(self, selection_name, stats=[' ',' ',' ',' ',' ',' '], REQUEST=None):
+ def getSelectionStats(self, selection_name, stats=_MARKER, REQUEST=None):
"""
Returns the stats in the selection
"""
- selection = self.getSelectionFor(selection_name, REQUEST=REQUEST)
- if selection is not None:
- try:
- return selection.stats
- except AttributeError:
- return stats # That is really bad programming XXX
- else:
- return stats
+ if stats is not _MARKER:
+ default_stats = stats
+ else:
+ default_stats = [' '] * 6
+ selection = self.getSelectionFor(selection_name, REQUEST=REQUEST)
+ if selection is not None:
+ return getattr(selection, stats, default_stats)
+ return default_stats
security.declareProtected(ERP5Permissions.View, 'viewFirst')
More information about the Erp5-report
mailing list