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 |