Mercurial > piecrust2
comparison piecrust/templating/jinjaengine.py @ 787:f6f9a284a5f3
routing: Simplify how route functions are declared and handled.
* Site config now only has to declare the function name.
* Simply code for running route functions.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 01 Sep 2016 23:00:58 -0700 |
parents | b91fe30ae7aa |
children | 0da1207472d3 |
comparison
equal
deleted
inserted
replaced
786:97c1dc568810 | 787:f6f9a284a5f3 |
---|---|
234 self.filters['raw'] = self.filters['safe'] | 234 self.filters['raw'] = self.filters['safe'] |
235 self.globals['pcfail'] = raise_exception | 235 self.globals['pcfail'] = raise_exception |
236 | 236 |
237 # Add route functions. | 237 # Add route functions. |
238 for route in app.routes: | 238 for route in app.routes: |
239 name = route.template_func_name | 239 name = route.func_name |
240 func = self.globals.get(name) | 240 func = self.globals.get(name) |
241 if func is None: | 241 if func is None: |
242 func = CompositeRouteFunction() | 242 func = CompositeRouteFunction() |
243 func.addFunc(route) | 243 func.addFunc(route) |
244 self.globals[name] = func | 244 self.globals[name] = func |