Changeset 3846
- Timestamp:
- 12/24/07 10:00:49 (7 months ago)
- Files:
-
- branches/1.1/CHANGELOG.txt (modified) (1 diff)
- branches/1.1/turbogears/paginate.py (modified) (2 diffs)
- branches/1.1/turbogears/tests/test_paginate.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/CHANGELOG.txt
r3825 r3846 43 43 * Paginate does a better handling of zeroed limit, avoiding ZeroDivisionError 44 44 exception (#1629). 45 46 Contributors 47 ~~~~~~~~~~~~ 48 49 Toshio Kuratomi. 45 * Fixed pagination of empty data when a SQL with "group by" is issued (#1641). 46 47 Contributors 48 ~~~~~~~~~~~~ 49 50 Toshio Kuratomi, ondrejj. 50 51 51 52 branches/1.1/turbogears/paginate.py
r3825 r3846 161 161 else: 162 162 df = default_order 163 163 164 164 ordering = dict([(v.lstrip('-'), [k, not v.startswith('-')]) 165 165 for k,v in enumerate(df)]) … … 172 172 (SASelectResults and isinstance(var_data, SASelectResults)) or \ 173 173 (Query and isinstance(var_data, Query)): 174 row_count = var_data.count() 174 row_count = var_data.count() or 0 175 175 if ordering: 176 176 # Build order_by list. branches/1.1/turbogears/tests/test_paginate.py
r3825 r3846 619 619 zero_limit = expose("turbogears.tests.paginate")(zero_limit) 620 620 621 def empty_with_groupby(self): 622 data = session.query(Address).filter(Address.c.id<0).group_by(Address.c.user_id) 623 624 spy = Spy(var_name='data', pages=[], limit=10, page_count=0, 625 order=None, row_count=0) 626 return dict(data=data, spy=spy) 627 628 empty_with_groupby = paginate("data", default_order="id")(empty_with_groupby) 629 empty_with_groupby = expose("turbogears.tests.paginate")(empty_with_groupby) 630 621 631 # end of MyRoot ------------------------------------------------------------ 622 632 … … 895 905 self.request("/zero_limit/?method=%s" % method) 896 906 self.assert_order(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) 907 908 def test_ticket_1641(self): 909 self.request("/empty_with_groupby") 910 self.assert_order() 897 911 898 912