web/views/baseviews.py
changeset 573 9c8fd72ba6c1
parent 570 0c9dfc430200
child 608 7433011bb811
equal deleted inserted replaced
572:9849fed789c9 573:9c8fd72ba6c1
    55     """display values without any transformation (i.e. get a number for
    55     """display values without any transformation (i.e. get a number for
    56     entities) 
    56     entities) 
    57     """
    57     """
    58     id = 'final'
    58     id = 'final'
    59             
    59             
    60     def cell_call(self, row, col, props=None, displaytime=False):
    60     def cell_call(self, row, col, props=None, displaytime=False, format='text/html'):
    61         etype = self.rset.description[row][col]
    61         etype = self.rset.description[row][col]
    62         value = self.rset.rows[row][col]
    62         value = self.rset.rows[row][col]
    63         if etype == 'String':
    63         if etype == 'String':
    64             entity, rtype = self.rset.related_entity(row, col)
    64             entity, rtype = self.rset.related_entity(row, col)
    65             if entity is not None:
    65             if entity is not None:
    66                 # yes !
    66                 # yes !
    67                 self.w(entity.printable_value(rtype, value))
    67                 self.w(entity.printable_value(rtype, value, format=format))
    68                 return
    68                 return
    69         if etype in ('Time', 'Interval'):
    69         if etype in ('Time', 'Interval'):
    70             _ = self.req._
    70             _ = self.req._
    71             # value is DateTimeDelta but we have no idea about what is the 
    71             # value is DateTimeDelta but we have no idea about what is the 
    72             # reference date here, so we can only approximate years and months
    72             # reference date here, so we can only approximate years and months
   637                     # csvrow.append(val) # val is eid in that case
   637                     # csvrow.append(val) # val is eid in that case
   638                     val = self.view('textincontext', rset,
   638                     val = self.view('textincontext', rset,
   639                                     row=rowindex, col=colindex)
   639                                     row=rowindex, col=colindex)
   640                 else:
   640                 else:
   641                     val = self.view('final', rset, displaytime=True,
   641                     val = self.view('final', rset, displaytime=True,
   642                                     row=rowindex, col=colindex)
   642                                     row=rowindex, col=colindex, format='text/plain')
   643                 w(simple_sgml_tag(tag, val, **attrs))
   643                 w(simple_sgml_tag(tag, val, **attrs))
   644             w(u' </row>\n')
   644             w(u' </row>\n')
   645         w(u'</%s>\n' % self.xml_root)
   645         w(u'</%s>\n' % self.xml_root)
   646     
   646     
   647 
   647 
   745                 if val is not None and not eschema(etype).is_final():
   745                 if val is not None and not eschema(etype).is_final():
   746                     # csvrow.append(val) # val is eid in that case
   746                     # csvrow.append(val) # val is eid in that case
   747                     content = self.view('textincontext', rset, 
   747                     content = self.view('textincontext', rset, 
   748                                         row=rowindex, col=colindex)
   748                                         row=rowindex, col=colindex)
   749                 else:
   749                 else:
   750                     content = self.view('final', rset, displaytime=True,
   750                     content = self.view('final', rset,
       
   751                                         displaytime=True, format='text/plain',
   751                                         row=rowindex, col=colindex)
   752                                         row=rowindex, col=colindex)
   752                 csvrow.append(content)                    
   753                 csvrow.append(content)                    
   753             writer.writerow(csvrow)
   754             writer.writerow(csvrow)
   754     
   755     
   755     
   756