[tableview] fix view selection when value is None (closes #1936781) stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 20 Sep 2011 15:14:04 +0200
branchstable
changeset 7814 1ec9fe1dfba9
parent 7813 89ab98c4aaab
child 7815 2a164a9cf81c
[tableview] fix view selection when value is None (closes #1936781) * in case of None on final view, use explicitly asked view anyway * when etype is None, that means it's a non final entity type
web/views/tableview.py
--- a/web/views/tableview.py	Tue Sep 20 15:13:42 2011 +0200
+++ b/web/views/tableview.py	Tue Sep 20 15:14:04 2011 +0200
@@ -257,14 +257,17 @@
         :param cellvid: cell view (defaults to 'outofcontext')
         """
         etype, val = self.cw_rset.description[row][col], self.cw_rset[row][col]
-        if val is not None and etype is not None and not self._cw.vreg.schema.eschema(etype).final:
-            self.wview(cellvid or 'outofcontext', self.cw_rset, row=row, col=col)
-        elif val is None:
-            # This is usually caused by a left outer join and in that case,
-            # regular views will most certainly fail if they don't have
-            # a real eid
-            self.wview('final', self.cw_rset, row=row, col=col)
+        if etype is None or not self._cw.vreg.schema.eschema(etype).final:
+            if val is None:
+                # This is usually caused by a left outer join and in that case,
+                # regular views will most certainly fail if they don't have
+                # a real eid
+                # XXX if cellvid is e.g. reledit, we may wanna call it anyway
+                self.w(u'&#160;')
+            else:
+                self.wview(cellvid or 'outofcontext', self.cw_rset, row=row, col=col)
         else:
+            # XXX why do we need a fallback view here?
             self.wview(cellvid or 'final', self.cw_rset, 'null', row=row, col=col)