Commit cd4f7671 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Make getSelectionParams public.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1201 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f39c1abb
...@@ -77,6 +77,7 @@ class Selection(Acquisition.Implicit, Traversable, Persistent): ...@@ -77,6 +77,7 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
""" """
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(ERP5Permissions.View)
def __init__(self, method_path=None, params=None, sort_on=None, def __init__(self, method_path=None, params=None, sort_on=None,
uids=None, invert_mode=0, list_url='', uids=None, invert_mode=0, list_url='',
...@@ -122,9 +123,9 @@ class Selection(Acquisition.Implicit, Traversable, Persistent): ...@@ -122,9 +123,9 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
setattr(self, 'selection_%s' % k, v) setattr(self, 'selection_%s' % k, v)
def __call__(self, selection_method = None, context=None, REQUEST=None): def __call__(self, selection_method = None, context=None, REQUEST=None):
LOG("Selection", 0, str(self.__dict__)) #LOG("Selection", 0, str(self.__dict__))
LOG("Selection", 0, str(selection_method)) #LOG("Selection", 0, str(selection_method))
#LOG('Selection', 0, "self.selection_invert_mode = %s" % repr(self.selection_invert_mode))
if self.selection_invert_mode is 0: if self.selection_invert_mode is 0:
if selection_method is None: if selection_method is None:
selection_method = context.unrestrictedTraverse(self.selection_method_path) selection_method = context.unrestrictedTraverse(self.selection_method_path)
...@@ -142,6 +143,7 @@ class Selection(Acquisition.Implicit, Traversable, Persistent): ...@@ -142,6 +143,7 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
del self.selection_params['sort_on'] del self.selection_params['sort_on']
if selection_method is not None: if selection_method is not None:
if callable(selection_method): if callable(selection_method):
#LOG('Selection', 0, "self.selection_params = %s" % repr(self.selection_params))
return selection_method(**self.selection_params) return selection_method(**self.selection_params)
else: else:
return [] return []
...@@ -154,8 +156,11 @@ class Selection(Acquisition.Implicit, Traversable, Persistent): ...@@ -154,8 +156,11 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
def __getitem__(self, index, REQUEST=None): def __getitem__(self, index, REQUEST=None):
return self(REQUEST)[index] return self(REQUEST)[index]
security.declareProtected(ERP5Permissions.View, 'getSelectionParams') security.declarePublic('getSelectionParams')
def getSelectionParams(self): def getSelectionParams(self):
"""
Get a dictionary of parameters in this selection.
"""
LOG('getSelectionParams',0,'selection_params: %s' % str(self.selection_params)) LOG('getSelectionParams',0,'selection_params: %s' % str(self.selection_params))
if self.selection_params is None: if self.selection_params is None:
self.selection_params = {} self.selection_params = {}
...@@ -165,6 +170,7 @@ class Selection(Acquisition.Implicit, Traversable, Persistent): ...@@ -165,6 +170,7 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
def getSelectionListUrl(self): def getSelectionListUrl(self):
result = '' result = ''
LOG('getSelectionListUrl', 0, 'selection_list_url = %s' % str(self.selection_list_url))
if self.selection_list_url is None: if self.selection_list_url is None:
self.selection_list_url = '' self.selection_list_url = ''
else: else:
......
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