web/views/tableview.py
changeset 7845 2172978be237
parent 7801 67f9677c1253
parent 7830 37d23a1d3547
child 7894 ad0eeb0f7a8d
--- a/web/views/tableview.py	Fri Sep 23 09:17:37 2011 +0200
+++ b/web/views/tableview.py	Fri Sep 23 14:18:13 2011 +0200
@@ -42,6 +42,9 @@
     title = _('table')
     finalview = 'final'
 
+    table_widget_class = TableWidget
+    table_column_class = TableColumn
+
     def form_filter(self, divid, displaycols, displayactions, displayfilter,
                     paginate, hidden=True):
         try:
@@ -144,7 +147,7 @@
         if paginate:
             self.divid = divid # XXX iirk (see usage in page_navigation_url)
             self.paginate(page_size=page_size, show_all_option=False)
-        table = TableWidget(self)
+        table = self.table_widget_class(self)
         for column in self.get_columns(computed_labels, displaycols, headers,
                                        subvid, cellvids, cellattrs, mainindex):
             table.append_column(column)
@@ -197,7 +200,7 @@
                     label = _label
             if colindex == mainindex and label is not None:
                 label += ' (%s)' % self.cw_rset.rowcount
-            column = TableColumn(label, colindex)
+            column = self.table_column_class(label, colindex)
             coltype = self.cw_rset.description[0][colindex]
             # compute column cell view (if coltype is None, it's a left outer
             # join, use the default non final subvid)
@@ -259,14 +262,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)