# HG changeset patch # User Sylvain Thénault # Date 1273659647 -7200 # Node ID 2d7f135846ee54e3c6ca9e9751fc2c99b103d125 # Parent bdc6a7e724f3eb669a7e14d89e0c898291c0edcd [primary view] allow new 'subvid' parameter in primaryview_display_ctrl diff -r bdc6a7e724f3 -r 2d7f135846ee web/views/primary.py --- a/web/views/primary.py Wed May 12 12:19:41 2010 +0200 +++ b/web/views/primary.py Wed May 12 12:20:47 2010 +0200 @@ -265,30 +265,33 @@ __regid__ = 'autolimited' def call(self, **kwargs): - # nb: rset retreived using entity.related with limit + 1 if any - # because of that, we known that rset.printable_rql() will return - # rql with no limit set anyway (since it's handled manually) + # nb: rset is retreived using entity.related with limit + 1 if any. + # Because of that, we know that rset.printable_rql() will return rql + # with no limit set anyway (since it's handled manually) if 'dispctrl' in self.cw_extra_kwargs: limit = self.cw_extra_kwargs['dispctrl'].get('limit') + subvid = self.cw_extra_kwargs['dispctrl'].get('subvid', 'incontext') else: limit = None + subvid = 'incontext' if limit is None or self.cw_rset.rowcount <= limit: if self.cw_rset.rowcount == 1: - self.wview('incontext', self.cw_rset, row=0) + self.wview(subvid, self.cw_rset, row=0) elif 1 < self.cw_rset.rowcount <= 5: - self.wview('csv', self.cw_rset) + self.wview('csv', self.cw_rset, subvid=subvid) else: self.w(u'
') - self.wview('simplelist', self.cw_rset) + self.wview('simplelist', self.cw_rset, subvid=subvid) self.w(u'
') # else show links to display related entities else: rql = self.cw_rset.printable_rql() self.cw_rset.limit(limit) # remove extra entity self.w(u'
') - self.wview('simplelist', self.cw_rset) - self.w(u'[%s]' % (self._cw.build_url(rql=rql), - self._cw._('see them all'))) + self.wview('simplelist', self.cw_rset, subvid=subvid) + self.w(u'[%s]' % ( + xml_escape(self._cw.build_url(rql=rql, vid=subvid)), + self._cw._('see them all'))) self.w(u'
')