web/views/tableview.py
changeset 3720 5376aaadd16b
parent 3457 0924d0d08d60
parent 3689 deb13e88e037
child 3729 e4f20b74af51
equal deleted inserted replaced
3678:29f74716fd70 3720:5376aaadd16b
    78         selected variables
    78         selected variables
    79         """
    79         """
    80         eschema = self._cw.vreg.schema.eschema
    80         eschema = self._cw.vreg.schema.eschema
    81         for i, etype in enumerate(self.cw_rset.description[0]):
    81         for i, etype in enumerate(self.cw_rset.description[0]):
    82             try:
    82             try:
    83                 if not eschema(etype).is_final():
    83                 if not eschema(etype).final:
    84                     return i
    84                     return i
    85             except KeyError: # XXX possible?
    85             except KeyError: # XXX possible?
    86                 continue
    86                 continue
    87         return None
    87         return None
    88 
    88 
   205             coltype = self.cw_rset.description[0][colindex]
   205             coltype = self.cw_rset.description[0][colindex]
   206             # compute column cell view (if coltype is None, it's a left outer
   206             # compute column cell view (if coltype is None, it's a left outer
   207             # join, use the default non final subvid)
   207             # join, use the default non final subvid)
   208             if cellvids and colindex in cellvids:
   208             if cellvids and colindex in cellvids:
   209                 column.append_renderer(cellvids[colindex], colindex)
   209                 column.append_renderer(cellvids[colindex], colindex)
   210             elif coltype is not None and self._cw.schema.eschema(coltype).is_final():
   210             elif coltype is not None and self._cw.schema.eschema(coltype).final:
   211                 column.append_renderer(self.finalview, colindex)
   211                 column.append_renderer(self.finalview, colindex)
   212             else:
   212             else:
   213                 column.append_renderer(subvid or 'incontext', colindex)
   213                 column.append_renderer(subvid or 'incontext', colindex)
   214             if cellattrs and colindex in cellattrs:
   214             if cellattrs and colindex in cellattrs:
   215                 for name, value in cellattrs[colindex].iteritems():
   215                 for name, value in cellattrs[colindex].iteritems():
   234         #     first characters of a string)
   234         #     first characters of a string)
   235         val = self.cw_rset[row][col]
   235         val = self.cw_rset[row][col]
   236         if val is None:
   236         if val is None:
   237             return u''
   237             return u''
   238         etype = self.cw_rset.description[row][col]
   238         etype = self.cw_rset.description[row][col]
   239         if self._cw.schema.eschema(etype).is_final():
   239         if self._cw.schema.eschema(etype).final:
   240             entity, rtype = self.cw_rset.related_entity(row, col)
   240             entity, rtype = self.cw_rset.related_entity(row, col)
   241             if entity is None:
   241             if entity is None:
   242                 return val # remove_html_tags() ?
   242                 return val # remove_html_tags() ?
   243             return entity.sortvalue(rtype)
   243             return entity.sortvalue(rtype)
   244         entity = self.cw_rset.get_entity(row, col)
   244         entity = self.cw_rset.get_entity(row, col)
   259         """
   259         """
   260         :param row, col: indexes locating the cell value in view's result set
   260         :param row, col: indexes locating the cell value in view's result set
   261         :param cellvid: cell view (defaults to 'outofcontext')
   261         :param cellvid: cell view (defaults to 'outofcontext')
   262         """
   262         """
   263         etype, val = self.cw_rset.description[row][col], self.cw_rset[row][col]
   263         etype, val = self.cw_rset.description[row][col], self.cw_rset[row][col]
   264         if val is not None and not self._cw.schema.eschema(etype).is_final():
   264         if val is not None and not self._cw.schema.eschema(etype).final:
   265             e = self.cw_rset.get_entity(row, col)
   265             e = self.cw_rset.get_entity(row, col)
   266             e.view(cellvid or 'outofcontext', w=self.w)
   266             e.view(cellvid or 'outofcontext', w=self.w)
   267         elif val is None:
   267         elif val is None:
   268             # This is usually caused by a left outer join and in that case,
   268             # This is usually caused by a left outer join and in that case,
   269             # regular views will most certainly fail if they don't have
   269             # regular views will most certainly fail if they don't have