[predicates] fix paginated_rset when the class has no page_size_property
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 03 Feb 2016 16:23:34 +0100
changeset 11092 3d177dfcdb19
parent 11091 29aebc1edd29
child 11093 f28a5c19d4ed
[predicates] fix paginated_rset when the class has no page_size_property Fixes test failure introduced by 70733b2dfd2a, which assumed paginated_rset would only be called on a class with a page_size_property attribute.
predicates.py
--- a/predicates.py	Wed Feb 03 14:23:17 2016 +0100
+++ b/predicates.py	Wed Feb 03 16:23:34 2016 +0100
@@ -498,7 +498,8 @@
                 except ValueError:
                     page_size = None
             if page_size is None:
-                page_size = req.property_value(cls.page_size_property)
+                page_size_prop = getattr(cls, 'page_size_property', 'navigation.page-size')
+                page_size = req.property_value(page_size_prop)
         if len(rset) <= (page_size*self.nbpages):
             return 0
         return self.nbpages