[Erp5-report] r34281 fabien - /erp5/trunk/products/ERP5/tests/testXHTML.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Apr 2 15:57:23 CEST 2010
Author: fabien
Date: Fri Apr 2 15:57:19 2010
New Revision: 34281
URL: http://svn.erp5.org?rev=34281&view=rev
Log:
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.
Modified:
erp5/trunk/products/ERP5/tests/testXHTML.py
Modified: erp5/trunk/products/ERP5/tests/testXHTML.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testXHTML.py?rev=34281&r1=34280&r2=34281&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testXHTML.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testXHTML.py [utf8] Fri Apr 2 15:57:19 2010
@@ -257,12 +257,17 @@
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."""
More information about the Erp5-report
mailing list