diff --git a/product/ERP5Form/Selection.py b/product/ERP5Form/Selection.py index 71d32d9288c55ada9e878fde3cc0da99c6a76127..fff897b417fe9132e1a4ac0a2fb37bf8b6d9b345 100755 --- a/product/ERP5Form/Selection.py +++ b/product/ERP5Form/Selection.py @@ -78,9 +78,14 @@ class Selection(Acquisition.Implicit, Traversable, Persistent): security = ClassSecurityInfo() - def __init__(self, method_path=None, params={}, sort_on=[], - uids=[], invert_mode=0, list_url='', - columns=[], checked_uids=[]): + def __init__(self, method_path=None, params=None, sort_on=None, + uids=None, invert_mode=0, list_url='', + columns=None, checked_uids=None): + if params is None: params = {} + if sort_on is None: sort_on = [] + if uids is None: uids = [] + if columns is None: columns = [] + if checked_uids is None: checked_uids = [] self.selection_method_path = method_path self.selection_params = params self.selection_uids = uids @@ -109,6 +114,9 @@ class Selection(Acquisition.Implicit, Traversable, Persistent): setattr(self, 'selection_%s' % k, v) def __call__(self, selection_method = None, context=None, REQUEST=None): + LOG("Selection", 0, str(self.__dict__)) + LOG("Selection", 0, str(selection_method)) + if self.selection_invert_mode is 0: if selection_method is None: # XXX Bad hack, we should not have unicode here XXX diff --git a/product/ERP5Form/SelectionTool.py b/product/ERP5Form/SelectionTool.py index 4b5e1818b09750c88e7e0736906a5a67a4753ee2..cfe204a78a77e0c7b11b9a650edeb578a511f31a 100755 --- a/product/ERP5Form/SelectionTool.py +++ b/product/ERP5Form/SelectionTool.py @@ -344,10 +344,11 @@ class SelectionTool( UniqueObject, SimpleItem ): selection.edit(columns=columns) security.declareProtected(ERP5Permissions.View, 'getSelectionColumns') - def getSelectionColumns(self, selection_name, columns=[], REQUEST=None): + def getSelectionColumns(self, selection_name, columns=None, REQUEST=None): """ Returns the columns in the selection """ + if columns is None: columns = [] selection = self.getSelectionFor(selection_name, REQUEST=REQUEST) if selection is not None: if len(selection.selection_columns) > 0: @@ -456,10 +457,11 @@ class SelectionTool( UniqueObject, SimpleItem ): # ListBox related methods security.declareProtected(ERP5Permissions.View, 'nextPage') - def nextPage(self, listbox_uid, uids=[], REQUEST=None): + def nextPage(self, listbox_uid, uids=None, REQUEST=None): """ Access the next page of a list """ + if uids is None: uids = [] request = REQUEST form_id = request.form_id selection_name = request.list_selection_name @@ -474,10 +476,11 @@ class SelectionTool( UniqueObject, SimpleItem ): return self.checkAll(selection_name, uids, REQUEST=REQUEST) security.declareProtected(ERP5Permissions.View, 'previousPage') - def previousPage(self, listbox_uid, uids=[], REQUEST=None): + def previousPage(self, listbox_uid, uids=None, REQUEST=None): """ Access the previous page of a list """ + if uids is None: uids = [] request = REQUEST form_id = request.form_id selection_name = request.list_selection_name @@ -492,10 +495,11 @@ class SelectionTool( UniqueObject, SimpleItem ): return self.checkAll(selection_name, uids, REQUEST=REQUEST) security.declareProtected(ERP5Permissions.View, 'setPage') - def setPage(self, listbox_uid, uids=[], REQUEST=None): + def setPage(self, listbox_uid, uids=None, REQUEST=None): """ Access the previous page of a list """ + if uids is None: uids = [] request = REQUEST form_id = request.form_id selection_name = request.list_selection_name diff --git a/product/ERP5Type/CopySupport.py b/product/ERP5Type/CopySupport.py index 3dd4c8360637ad2f869d16b0f7660436ae3b191a..4dd31a314c677efc7e118c91605461cf6ffd30a6 100755 --- a/product/ERP5Type/CopySupport.py +++ b/product/ERP5Type/CopySupport.py @@ -112,11 +112,13 @@ class CopyContainer: security.declareProtected( Permissions.DeletePortalContent, 'manage_delObjects' ) - def manage_delObjects(self, ids=[], uids=[], REQUEST=None): + def manage_delObjects(self, ids=None, uids=None, REQUEST=None): """Delete a subordinate object The objects specified in 'ids' get deleted. """ + if ids is None: ids = [] + if uids is None: uids = [] if len(ids) > 0: # Use default method return ObjectManager.manage_delObjects(self, ids, REQUEST) @@ -211,7 +213,7 @@ class CopyContainer: #LOG("unindexObject",0, str(self.id)) security.declareProtected(Permissions.ModifyPortalContent, 'moveObject') - def moveObject(self, idxs=[]): + def moveObject(self, idxs=None): """ Reindex the object in the portal catalog. If idxs is present, only those indexes are reindexed. @@ -223,6 +225,7 @@ class CopyContainer: Passes is_object_moved to catalog to force reindexing without creating new uid """ + if idxs is None: idxs = [] if idxs == []: # Update the modification date. if hasattr(aq_base(self), 'notifyModified'):