changeset 869:41b0c94f9833

refactor: Fix some last instance of using the old API.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 12 Jun 2017 22:22:42 -0700
parents 8d25f76fce98
children 48d25fd68b8d
files piecrust/templating/jinja/environment.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/templating/jinja/environment.py	Mon Jun 12 22:22:19 2017 -0700
+++ b/piecrust/templating/jinja/environment.py	Mon Jun 12 22:22:42 2017 -0700
@@ -84,12 +84,11 @@
             self.globals['pcfail'] = raise_exception
 
     def _paginate(self, value, items_per_page=5):
-        cpi = self.app.env.exec_info_stack.current_page_info
-        if cpi is None or cpi.page is None or cpi.render_ctx is None:
+        ctx = self.app.env.render_ctx_stack.current_ctx
+        if ctx is None or ctx.page is None:
             raise Exception("Can't paginate when no page has been pushed "
                             "on the execution stack.")
-        return Paginator(cpi.page, value,
-                         page_num=cpi.render_ctx.page_num,
+        return Paginator(value, ctx.page, ctx.sub_num,
                          items_per_page=items_per_page)
 
     def _formatWith(self, value, format_name):