don't accept None to avoid error stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 29 Sep 2009 15:10:56 +0200
branchstable
changeset 3523 16880e7ee3fa
parent 3522 cde0ff4f7a8c
child 3524 a3431f4e2f40
child 3525 2dc3908f667f
don't accept None to avoid error
web/test/unittest_application.py
web/views/ibreadcrumbs.py
--- a/web/test/unittest_application.py	Tue Sep 29 15:10:13 2009 +0200
+++ b/web/test/unittest_application.py	Tue Sep 29 15:10:56 2009 +0200
@@ -138,6 +138,11 @@
 
 
 class ApplicationTC(EnvBasedTC):
+    def setUp(self):
+        super(ApplicationTC, self).setUp()
+        def raise_hdlr(*args, **kwargs):
+            raise
+        self.app.error_handler = raise_hdlr
 
     def publish(self, req, path='view'):
         return self.app.publish(path, req)
@@ -411,6 +416,12 @@
         self.assertRaises(AuthenticationError, self.publish, req, 'logout')
         self.assertEquals(len(self.open_sessions), 0)
 
+    def test_non_regr_optional_first_var(self):
+        req = self.request()
+        # expect a rset with None in [0][0]
+        req.form['rql'] = 'rql:Any OV1, X WHERE X custom_workflow OV1?'
+        self.publish(req)
+        print 'yuea'
 
 if __name__ == '__main__':
     unittest_main()
--- a/web/views/ibreadcrumbs.py	Tue Sep 29 15:10:13 2009 +0200
+++ b/web/views/ibreadcrumbs.py	Tue Sep 29 15:10:56 2009 +0200
@@ -21,7 +21,7 @@
 
 class BreadCrumbEntityVComponent(Component):
     id = 'breadcrumbs'
-    __select__ = one_line_rset() & implements(IBreadCrumbs)
+    __select__ = one_line_rset() & implements(IBreadCrumbs, accept_none=False)
 
     property_defs = {
         _('visible'):  dict(type='Boolean', default=True,
@@ -70,7 +70,8 @@
 
 
 class BreadCrumbETypeVComponent(BreadCrumbEntityVComponent):
-    __select__ = two_lines_rset() & one_etype_rset() & implements(IBreadCrumbs)
+    __select__ = two_lines_rset() & one_etype_rset() & \
+                 implements(IBreadCrumbs, accept_none=False)
 
     def render_breadcrumbs(self, contextentity, path):
         # XXX hack: only display etype name or first non entity path part