web/views/tableview.py
branchstable
changeset 3689 deb13e88e037
parent 3228 7b05b2709439
child 3720 5376aaadd16b
child 3807 8ae53322ffcc
equal deleted inserted replaced
3688:421fb447ecb2 3689:deb13e88e037
    78         selected variables
    78         selected variables
    79         """
    79         """
    80         eschema = self.vreg.schema.eschema
    80         eschema = self.vreg.schema.eschema
    81         for i, etype in enumerate(self.rset.description[0]):
    81         for i, etype in enumerate(self.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 
   206             coltype = self.rset.description[0][colindex]
   206             coltype = self.rset.description[0][colindex]
   207             # compute column cell view (if coltype is None, it's a left outer
   207             # compute column cell view (if coltype is None, it's a left outer
   208             # join, use the default non final subvid)
   208             # join, use the default non final subvid)
   209             if cellvids and colindex in cellvids:
   209             if cellvids and colindex in cellvids:
   210                 column.append_renderer(cellvids[colindex], colindex)
   210                 column.append_renderer(cellvids[colindex], colindex)
   211             elif coltype is not None and self.schema.eschema(coltype).is_final():
   211             elif coltype is not None and self.schema.eschema(coltype).final:
   212                 column.append_renderer(self.finalview, colindex)
   212                 column.append_renderer(self.finalview, colindex)
   213             else:
   213             else:
   214                 column.append_renderer(subvid or 'incontext', colindex)
   214                 column.append_renderer(subvid or 'incontext', colindex)
   215             if cellattrs and colindex in cellattrs:
   215             if cellattrs and colindex in cellattrs:
   216                 for name, value in cellattrs[colindex].iteritems():
   216                 for name, value in cellattrs[colindex].iteritems():
   235         #     first characters of a string)
   235         #     first characters of a string)
   236         val = self.rset[row][col]
   236         val = self.rset[row][col]
   237         if val is None:
   237         if val is None:
   238             return u''
   238             return u''
   239         etype = self.rset.description[row][col]
   239         etype = self.rset.description[row][col]
   240         if self.schema.eschema(etype).is_final():
   240         if self.schema.eschema(etype).final:
   241             entity, rtype = self.rset.related_entity(row, col)
   241             entity, rtype = self.rset.related_entity(row, col)
   242             if entity is None:
   242             if entity is None:
   243                 return val # remove_html_tags() ?
   243                 return val # remove_html_tags() ?
   244             return entity.sortvalue(rtype)
   244             return entity.sortvalue(rtype)
   245         entity = self.rset.get_entity(row, col)
   245         entity = self.rset.get_entity(row, col)
   261         """
   261         """
   262         :param row, col: indexes locating the cell value in view's result set
   262         :param row, col: indexes locating the cell value in view's result set
   263         :param cellvid: cell view (defaults to 'outofcontext')
   263         :param cellvid: cell view (defaults to 'outofcontext')
   264         """
   264         """
   265         etype, val = self.rset.description[row][col], self.rset[row][col]
   265         etype, val = self.rset.description[row][col], self.rset[row][col]
   266         if val is not None and not self.schema.eschema(etype).is_final():
   266         if val is not None and not self.schema.eschema(etype).final:
   267             e = self.rset.get_entity(row, col)
   267             e = self.rset.get_entity(row, col)
   268             e.view(cellvid or 'outofcontext', w=self.w)
   268             e.view(cellvid or 'outofcontext', w=self.w)
   269         elif val is None:
   269         elif val is None:
   270             # This is usually caused by a left outer join and in that case,
   270             # This is usually caused by a left outer join and in that case,
   271             # regular views will most certainly fail if they don't have
   271             # regular views will most certainly fail if they don't have