[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
--- 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' ')
+ 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)