web/views/baseviews.py
changeset 400 b05a36678265
parent 371 4e849b424aaa
child 431 18b4dd650ef8
equal deleted inserted replaced
399:8df3b190275b 400:b05a36678265
    29 from cubicweb.common.view import EntityView, AnyRsetView, EmptyRsetView
    29 from cubicweb.common.view import EntityView, AnyRsetView, EmptyRsetView
    30 from cubicweb.web.httpcache import MaxAgeHTTPCacheManager
    30 from cubicweb.web.httpcache import MaxAgeHTTPCacheManager
    31 from cubicweb.web.views import vid_from_rset, linksearch_select_url, linksearch_match
    31 from cubicweb.web.views import vid_from_rset, linksearch_select_url, linksearch_match
    32 
    32 
    33 _ = unicode
    33 _ = unicode
    34 
       
    35 
    34 
    36 class NullView(AnyRsetView):
    35 class NullView(AnyRsetView):
    37     """default view when no result has been found"""
    36     """default view when no result has been found"""
    38     id = 'null'
    37     id = 'null'
    39     __select__ = classmethod(yes)
    38     __select__ = classmethod(yes)
   763         writer = self.csvwriter()
   762         writer = self.csvwriter()
   764         rowdef_by_type = {}
   763         rowdef_by_type = {}
   765         for index in xrange(len(self.rset)):
   764         for index in xrange(len(self.rset)):
   766             entity = self.complete_entity(index)
   765             entity = self.complete_entity(index)
   767             if entity.e_schema not in rows_by_type:
   766             if entity.e_schema not in rows_by_type:
   768                 rowdef_by_type[entity.e_schema] = [rs for rs, as in entity.e_schema.attribute_definitions()
   767                 rowdef_by_type[entity.e_schema] = [rs for rs, at in entity.e_schema.attribute_definitions()
   769                                                    if as.type != 'Bytes']
   768                                                    if at != 'Bytes']
   770                 rows_by_type[entity.e_schema] = [[display_name(req, rschema.type)
   769                 rows_by_type[entity.e_schema] = [[display_name(req, rschema.type)
   771                                                   for rschema in rowdef_by_type[entity.e_schema]]]
   770                                                   for rschema in rowdef_by_type[entity.e_schema]]]
   772             rows = rows_by_type[entity.e_schema]
   771             rows = rows_by_type[entity.e_schema]
   773             rows.append([entity.printable_value(rs.type, format='text/plain')
   772             rows.append([entity.printable_value(rs.type, format='text/plain')
   774                          for rs in rowdef_by_type[entity.e_schema]])
   773                          for rs in rowdef_by_type[entity.e_schema]])