handle displayctrl['limit'] == None correctly stable
authorAlexandre Fayolle <alexandre.fayolle@logilab.fr>
Mon, 20 Sep 2010 15:50:12 +0200
branchstable
changeset 6290 f68dd9dd3af2
parent 6289 163a7f1d5bba
child 6291 f6cba3be6ba2
handle displayctrl['limit'] == None correctly
web/views/primary.py
--- a/web/views/primary.py	Fri Sep 17 19:30:22 2010 +0200
+++ b/web/views/primary.py	Mon Sep 20 15:50:12 2010 +0200
@@ -247,7 +247,10 @@
     def _relation_rset(self, entity, rschema, role, dispctrl):
         try:
             dispctrl.setdefault('limit', self.maxrelated)
-            rset = entity.related(rschema.type, role, limit=dispctrl['limit']+1)
+            limit = dispctrl['limit']
+            if limit is not None:
+                limit += 1
+            rset = entity.related(rschema.type, role, limit=limit)
         except Unauthorized:
             return
         if 'filter' in dispctrl: