Commit e7b3d88f authored by Ivan Tyagov's avatar Ivan Tyagov

Set in REQUEST the current ERP5 form & field id in a similar way as 'cell'...

Set in REQUEST the current ERP5 form & field id in a similar way as 'cell' request argument.This allows scipts used for listbox rendering be aware of current ERP5 form being rendered and access form itself. Add test for this.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38382 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2e91e7a2
...@@ -2616,6 +2616,12 @@ class ListBoxHTMLRenderer(ListBoxRenderer): ...@@ -2616,6 +2616,12 @@ class ListBoxHTMLRenderer(ListBoxRenderer):
selection.edit(method_path = method_path, list_url = list_url) selection.edit(method_path = method_path, list_url = list_url)
self.getSelectionTool().setSelectionFor(self.getSelectionName(), selection, REQUEST = self.request) self.getSelectionTool().setSelectionFor(self.getSelectionName(), selection, REQUEST = self.request)
# do pass current form and respective field through request
request = self.request
field_id = self.getId()
form = self.getForm()
request.set('form_id', form.getId())
request.set('field_id', field_id)
pt = self.getPageTemplate() pt = self.getPageTemplate()
return pt() return pt()
......
...@@ -622,6 +622,20 @@ return [] ...@@ -622,6 +622,20 @@ return []
self.assertSameSet([('id', u'ID'), ('title', u'Title'), ('getQuantity', u'Quantity')], self.assertSameSet([('id', u'ID'), ('title', u'Title'), ('getQuantity', u'Quantity')],
getListBoxRenderer(listbox).getSelectedColumnList()) getListBoxRenderer(listbox).getSelectedColumnList())
def test_ListboxRequestParameterPropagandation(self):
"""
Test that rendering a listbox field will set respective form & field_id of current form
in REQUEST for further usage by used by litsbox's columns methods.
"""
portal = self.getPortal()
request = get_request()
portal.ListBoxZuite_reset()
form = portal.FooModule_viewFooList
self.assertEqual(None, request.get('form_id'))
form.render()
self.assertEqual(form.getId(), request.get('form_id'))
self.assertEqual(form.listbox.getId(), request.get('field_id'))
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
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