Commit 7e9b806a authored by Fabien Morin's avatar Fabien Morin

use restrictedTraverse instead of getattr this make possible to use context in

list_action like "person_module/view" (which is used in
erp5_gadget/ERP5Site_viewPersonListGadget)
Make error message easier to read.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34281 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 17338044
......@@ -257,12 +257,17 @@ class TestXHTML(ERP5TypeTestCase):
if list_action and list_action != 'list': # We assume that 'list'
# list_action exists
if isinstance(list_action, str):
method = getattr(self.portal, list_action.split('?')[0], None)
try:
list_action = list_action.split('?')[0]
method = self.portal.restrictedTraverse(list_action)
except KeyError:
method = None
else:
method = list_action
if not callable(method):
error_list.append(('%s/%s' % (form_path, field.id), list_action))
self.assertEquals(error_list, [])
error_list.append('Form %s/%s : list_action "%s" is not callable.'\
% (form_path, field.id, list_action))
self.assert_(not len(error_list), '\n'.join(error_list))
def test_moduleListMethod(self):
"""Make sure that module's list method works."""
......
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