Mercurial > piecrust2
comparison piecrust/templating/_inukshukext.py @ 1137:10fd55b9ccfb
templating: Fix Inukshuk `paginate` function.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 24 Apr 2018 21:27:46 -0700 |
parents | 576f7ebcd9c0 |
children |
comparison
equal
deleted
inserted
replaced
1136:5f97b5b59dfe | 1137:10fd55b9ccfb |
---|---|
50 def _paginate(self, value, items_per_page=5): | 50 def _paginate(self, value, items_per_page=5): |
51 ctx = self.app.env.render_ctx_stack.current_ctx | 51 ctx = self.app.env.render_ctx_stack.current_ctx |
52 if ctx is None or ctx.page is None: | 52 if ctx is None or ctx.page is None: |
53 raise Exception("Can't paginate when no page has been pushed " | 53 raise Exception("Can't paginate when no page has been pushed " |
54 "on the execution stack.") | 54 "on the execution stack.") |
55 return Paginator(ctx.page, value, | 55 return Paginator(value, ctx.page, |
56 sub_num=ctx.sub_num, | 56 sub_num=ctx.sub_num, |
57 items_per_page=items_per_page) | 57 items_per_page=items_per_page) |
58 | 58 |
59 def _formatWith(self, value, format_name): | 59 def _formatWith(self, value, format_name): |
60 return format_text(self.app, format_name, value) | 60 return format_text(self.app, format_name, value) |