Commit dbf32de9 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

add SelectionTool.getSelectionIndexFor().

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13805 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c76429d2
...@@ -380,6 +380,15 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -380,6 +380,15 @@ class SelectionTool( UniqueObject, SimpleItem ):
return selection.getInvertModeUidList() return selection.getInvertModeUidList()
return 0 return 0
security.declareProtected(ERP5Permissions.View, 'getSelectionIndexFor')
def getSelectionIndexFor(self, selection_name, REQUEST=None):
"""Get the 'index' parameter of a selection.
"""
selection = self.getSelectionFor(selection_name, REQUEST=REQUEST)
if selection is not None:
return selection.getIndex()
return None
security.declareProtected(ERP5Permissions.View, 'setSelectionToIds') security.declareProtected(ERP5Permissions.View, 'setSelectionToIds')
def setSelectionToIds(self, selection_name, selection_uids, REQUEST=None): def setSelectionToIds(self, selection_name, selection_uids, REQUEST=None):
""" """
......
...@@ -209,6 +209,11 @@ class TestSelectionTool(ERP5TypeTestCase): ...@@ -209,6 +209,11 @@ class TestSelectionTool(ERP5TypeTestCase):
self.assertEquals({}, self.assertEquals({},
self.portal_selections.getSelectionReportDictFor('test_selection')) self.portal_selections.getSelectionReportDictFor('test_selection'))
def testIndex(self, quiet=quiet, run=run_all_test):
if not run: return
self.assertEquals(None,
self.portal_selections.getSelectionIndexFor('test_selection'))
if __name__ == '__main__': if __name__ == '__main__':
framework() framework()
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