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
...@@ -257,12 +257,9 @@ class Selection(Acquisition.Implicit, Traversable, Persistent): ...@@ -257,12 +257,9 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
""" """
Get a dictionary of parameters in this selection. Get a dictionary of parameters in this selection.
""" """
#LOG('getParams',0,'params: %s' % str(self.params)) if not isinstance(self.params, dict):
if self.params is None:
self.params = {} self.params = {}
if type(self.params) != type({}): return self.params.copy()
self.params = {}
return self.params
security.declarePublic('getSortOrder') security.declarePublic('getSortOrder')
def getSortOrder(self): def getSortOrder(self):
......
...@@ -258,14 +258,12 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ): ...@@ -258,14 +258,12 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
""" """
Returns the params in the selection Returns the params in the selection
""" """
if params is None: params = {} if params is None:
params = {}
selection = self.getSelectionFor(selection_name, REQUEST=REQUEST) selection = self.getSelectionFor(selection_name, REQUEST=REQUEST)
if selection is not None: if selection is not None:
if len(selection.params) > 0: if selection.params:
return selection.getParams() return selection.getParams()
else:
return params
else:
return params return params
# backward compatibility # 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