comparison piecrust/templating/jinja/environment.py @ 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 08e02c2a2a1a
children 3e69f18912f5
comparison
equal deleted inserted replaced
868:8d25f76fce98 869:41b0c94f9833
82 if twig_compatibility_mode is True: 82 if twig_compatibility_mode is True:
83 self.filters['raw'] = self.filters['safe'] 83 self.filters['raw'] = self.filters['safe']
84 self.globals['pcfail'] = raise_exception 84 self.globals['pcfail'] = raise_exception
85 85
86 def _paginate(self, value, items_per_page=5): 86 def _paginate(self, value, items_per_page=5):
87 cpi = self.app.env.exec_info_stack.current_page_info 87 ctx = self.app.env.render_ctx_stack.current_ctx
88 if cpi is None or cpi.page is None or cpi.render_ctx is None: 88 if ctx is None or ctx.page is None:
89 raise Exception("Can't paginate when no page has been pushed " 89 raise Exception("Can't paginate when no page has been pushed "
90 "on the execution stack.") 90 "on the execution stack.")
91 return Paginator(cpi.page, value, 91 return Paginator(value, ctx.page, ctx.sub_num,
92 page_num=cpi.render_ctx.page_num,
93 items_per_page=items_per_page) 92 items_per_page=items_per_page)
94 93
95 def _formatWith(self, value, format_name): 94 def _formatWith(self, value, format_name):
96 return format_text(self.app, format_name, value) 95 return format_text(self.app, format_name, value)
97 96