Commit eaa1a2a7 authored by Jérome Perrin's avatar Jérome Perrin

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


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30862 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f3622be3
No related merge requests found
......@@ -257,12 +257,9 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
"""
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):
......
......@@ -258,14 +258,12 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
"""
Returns the params in the selection
"""
if params is None: params = {}
if params is None:
params = {}
selection = self.getSelectionFor(selection_name, REQUEST=REQUEST)
if selection is not None:
if len(selection.params) > 0:
if selection.params:
return selection.getParams()
else:
return params
else:
return params
# backward compatibility
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment