[Cubicweb] primaryview_display_ctrl use can break 'see all' link

Alexandre Fayolle alexandre.fayolle at logilab.fr
Mon Sep 20 15:50:41 CEST 2010

On Monday 20 September 2010 14:58:33 Sylvain Thénault wrote:
> > Question: how can I tell CW that I always want to see all the related
> > elements  on the "Bibliotheque conserve" relation in the primary view?
> Specifying custom 'vid' in primaryview_display_ctrl as you've done should
> be enough. Provided we fix the bug :)
> Now to tell a bit more about this:
> by default, the primary view use 'autolimited' as vid. This is the view
> that will use comma separated values or list view and limit your rset if
> there is too much items in it (and generate the "view all" link in this
> case).
> You can control this view by setting the following values in the pvdc rtag:
> * 'limit', maximum number of entities to display. The value of the
>   'navigation.related-limit'  cwproperty is used by default (which is 8 by
> default). If None, no limit.

I juste tried using:

_pdc.tag_subject_of(('Bibliotheque', 'conserve', '*'), 
                               {'vid': 'cotebibliview',
                                 'limit': None})


Traceback (most recent call last):
  File "/home/alf/cubicweb/cubicweb/web/application.py", line 388, in 
    result = controller.publish(rset=rset)
  File "/home/alf/cubicweb/cubicweb/web/views/basecontrollers.py", line 123, 
in publish
    rset=rset, view=view)
  File "/home/alf/cubicweb/cubicweb/cwvreg.py", line 378, in main_template
    res = obj.render(**kwargs)
  File "/home/alf/cubicweb/cubicweb/view.py", line 174, in render
  File "/home/alf/cubicweb/cubicweb/web/views/basetemplates.py", line 141, in 
  File "/home/alf/cubicweb/cubicweb/view.py", line 174, in render
  File "/home/alf/cubicweb/cubicweb/view.py", line 375, in call
    super(EntityView, self).call(**kwargs)
  File "/home/alf/cubicweb/cubicweb/view.py", line 213, in call
    self.wview(self.__regid__, rset, row=i, **kwargs)
  File "/home/alf/cubicweb/cubicweb/view.py", line 269, in wview
    self._cw.view(__vid, rset, __fallback_vid, w=self.w, **kwargs)
  File "/home/alf/cubicweb/cubicweb/req.py", line 314, in view
    return view.render(w=w, **kwargs)
  File "/home/alf/cubicweb/cubicweb/view.py", line 174, in render
  File "/home/alf/cubicweb/cubicweb/web/views/primary.py", line 58, in 
  File "/home/alf/cubicweb/cubicweb/web/views/primary.py", line 76, in 
  File "/home/alf/cubicweb/cubicweb/web/views/primary.py", line 173, in 
    rset = self._relation_rset(entity, rschema, role, dispctrl)
  File "/home/alf/cubicweb/cubicweb/web/views/primary.py", line 250, in 
    rset = entity.related(rschema.type, role, limit=dispctrl['limit']+1)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

I've just pushed a fix on the stable branch of CW fixing this :-)

Alexandre Fayolle                              LOGILAB, Paris (France)
Formations Python, CubicWeb, Debian :  http://www.logilab.fr/formations
Développement logiciel sur mesure :      http://www.logilab.fr/services
Informatique scientifique:               http://www.logilab.fr/science

More information about the Cubicweb mailing list