web/views/baseviews.py
changeset 2468 93853b6f3bad
parent 2312 af4d8f75c5db
child 2469 b87c4d150e09
equal deleted inserted replaced
2467:6983631f5d0d 2468:93853b6f3bad
   256     def cell_call(self, row, col=0, vid=None, **kwargs):
   256     def cell_call(self, row, col=0, vid=None, **kwargs):
   257         self.w(u'<li>')
   257         self.w(u'<li>')
   258         self.wview(self.item_vid, self.rset, row=row, col=col, vid=vid, **kwargs)
   258         self.wview(self.item_vid, self.rset, row=row, col=col, vid=vid, **kwargs)
   259         self.w(u'</li>\n')
   259         self.w(u'</li>\n')
   260 
   260 
   261     def url(self):
       
   262         """overrides url method so that by default, the view list is called
       
   263         with sorted entities
       
   264         """
       
   265         coltypes = self.rset.column_types(0)
       
   266         # don't want to generate the rql if there is some restriction on
       
   267         # something else than the entity type
       
   268         if len(coltypes) == 1:
       
   269             # XXX norestriction is not correct here. For instance, in cases like
       
   270             # Any P,N WHERE P is Project, P name N
       
   271             # norestriction should equal True
       
   272             restr = self.rset.syntax_tree().children[0].where
       
   273             norestriction = (isinstance(restr, nodes.Relation) and
       
   274                              restr.is_types_restriction())
       
   275             if norestriction:
       
   276                 etype = iter(coltypes).next()
       
   277                 return self.build_url(etype.lower(), vid=self.id)
       
   278         if len(self.rset) == 1:
       
   279             entity = self.rset.get_entity(0, 0)
       
   280             return self.build_url(entity.rest_path(), vid=self.id)
       
   281         return self.build_url(rql=self.rset.printable_rql(), vid=self.id)
       
   282 
       
   283 
   261 
   284 class ListItemView(EntityView):
   262 class ListItemView(EntityView):
   285     id = 'listitem'
   263     id = 'listitem'
   286 
   264 
   287     @property
   265     @property