[Erp5-report] r30862 - in /erp5/trunk/products/ERP5Form: Selection.py Tool/SelectionTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Nov 25 17:34:10 CET 2009
Author: jerome
Date: Wed Nov 25 17:34:04 2009
New Revision: 30862
URL: http://svn.erp5.org?rev=30862&view=rev
Log:
return a copy of the selection params in selection.getParams() and
selection_tool.getSelectionParamsFor, to prevent the callers to modify
selection params without using the api
Modified:
erp5/trunk/products/ERP5Form/Selection.py
erp5/trunk/products/ERP5Form/Tool/SelectionTool.py
Modified: erp5/trunk/products/ERP5Form/Selection.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/Selection.py?rev=30862&r1=30861&r2=30862&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/Selection.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/Selection.py [utf8] Wed Nov 25 17:34:04 2009
@@ -257,12 +257,9 @@
"""
Get a dictionary of parameters in this selection.
"""
- #LOG('getParams',0,'params: %s' % str(self.params))
- if self.params is None:
+ if not isinstance(self.params, dict):
self.params = {}
- if type(self.params) != type({}):
- self.params = {}
- return self.params
+ return self.params.copy()
security.declarePublic('getSortOrder')
def getSortOrder(self):
Modified: erp5/trunk/products/ERP5Form/Tool/SelectionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/Tool/SelectionTool.py?rev=30862&r1=30861&r2=30862&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/Tool/SelectionTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/Tool/SelectionTool.py [utf8] Wed Nov 25 17:34:04 2009
@@ -258,15 +258,13 @@
"""
Returns the params in the selection
"""
- if params is None: params = {}
- selection = self.getSelectionFor(selection_name, REQUEST=REQUEST)
- if selection is not None:
- if len(selection.params) > 0:
+ if params is None:
+ params = {}
+ selection = self.getSelectionFor(selection_name, REQUEST=REQUEST)
+ if selection is not None:
+ if selection.params:
return selection.getParams()
- else:
- return params
- else:
- return params
+ return params
# backward compatibility
security.declareProtected(ERP5Permissions.View, 'getSelectionParams')
More information about the Erp5-report
mailing list