Mercurial > piecrust2
diff piecrust/templating/jinjaengine.py @ 802:0da1207472d3
templating: Put the routing functions in the data, not the template engine.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 29 Sep 2016 21:52:18 -0700 |
parents | f6f9a284a5f3 |
children | 8f8bbb2e70e1 |
line wrap: on
line diff
--- a/piecrust/templating/jinjaengine.py Thu Sep 29 21:28:20 2016 -0700 +++ b/piecrust/templating/jinjaengine.py Thu Sep 29 21:52:18 2016 -0700 @@ -17,7 +17,6 @@ from piecrust.data.paginator import Paginator from piecrust.environment import AbortedSourceUseError from piecrust.rendering import format_text -from piecrust.routing import CompositeRouteFunction from piecrust.templating.base import (TemplateEngine, TemplateNotFoundError, TemplatingError) from piecrust.uriutil import multi_replace @@ -234,21 +233,6 @@ self.filters['raw'] = self.filters['safe'] self.globals['pcfail'] = raise_exception - # Add route functions. - for route in app.routes: - name = route.func_name - func = self.globals.get(name) - if func is None: - func = CompositeRouteFunction() - func.addFunc(route) - self.globals[name] = func - elif isinstance(func, CompositeRouteFunction): - self.globals[name].addFunc(route) - else: - raise Exception("Route function '%s' collides with an " - "existing function or template data." % - name) - 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: