Mercurial > piecrust2
diff piecrust/data/builder.py @ 854:08e02c2a2a1a
core: Keep refactoring, this time to prepare for generator sources.
- Make a few APIs simpler.
- Content pipelines create their own jobs, so that generator sources can
keep aborting in `getContents`, but rely on their pipeline to generate
pages for baking.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 04 Jun 2017 23:34:28 -0700 |
parents | f070a4fc033c |
children | d9059257743c |
line wrap: on
line diff
--- a/piecrust/data/builder.py Sun May 21 00:06:59 2017 -0700 +++ b/piecrust/data/builder.py Sun Jun 04 23:34:28 2017 -0700 @@ -1,7 +1,7 @@ import logging from piecrust.data.assetor import Assetor from piecrust.data.base import MergedMapping -# from piecrust.data.linker import PageLinkerData +from piecrust.data.linker import Linker from piecrust.data.pagedata import PageData from piecrust.data.paginator import Paginator from piecrust.data.piecrustdata import PieCrustData @@ -32,13 +32,13 @@ paginator = Paginator(pgn_source, page, sub_num, pgn_filter=ctx.pagination_filter) assetor = Assetor(page) - # linker = PageLinkerData(page.source, page.rel_path) + linker = Linker(page) data = { 'piecrust': pc_data, 'page': config_data, 'assets': assetor, 'pagination': paginator, - # 'family': linker + 'family': linker } for route in app.routes: @@ -49,6 +49,12 @@ func = data.get(name) if func is None: data[name] = RouteFunction(route) + elif isinstance(func, RouteFunction): + if not func._isCompatibleRoute(route): + raise Exception( + "Route function '%s' can't target both route '%s' and " + "route '%s' as the 2 patterns are incompatible." % + (name, func._route.uri_pattern, route.uri_pattern)) else: raise Exception("Route function '%s' collides with an " "existing function or template data." %