Fix handling of limit within the primary view for related elements. Closes #4723579
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 04 Dec 2014 11:37:10 +0100
changeset 10179 a328b91938b2
parent 10178 4b33246cb43c
child 10180 ea10572fccfe
Fix handling of limit within the primary view for related elements. Closes #4723579 * respect limit set by uicfg (like the 'autolimited' view itself does) * set limit in rql query to one more than the specified one so the view knows there are more things to display
web/views/primary.py
--- a/web/views/primary.py	Mon Dec 29 12:35:34 2014 +0100
+++ b/web/views/primary.py	Thu Dec 04 11:37:10 2014 +0100
@@ -237,7 +237,9 @@
                                      rtype=rschema.type, role=role)
             else:
                 vid = dispctrl.get('vid', 'autolimited')
-                limit = defaultlimit if vid == 'autolimited' else None
+                limit = dispctrl.get('limit', defaultlimit) if vid == 'autolimited' else None
+                if limit is not None:
+                    limit += 1 # need one more so the view can check if there is more than the limit
                 rset = self._relation_rset(entity, rschema, role, dispctrl, limit=limit)
                 if not rset:
                     continue