Mercurial > piecrust2
comparison piecrust/serving/util.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 | fddaf43424e2 |
comparison
equal
deleted
inserted
replaced
853:f070a4fc033c | 854:08e02c2a2a1a |
---|---|
61 for route, route_params, route_sub_num in routes: | 61 for route, route_params, route_sub_num in routes: |
62 cur_req_path = req_path | 62 cur_req_path = req_path |
63 if route_sub_num > 1: | 63 if route_sub_num > 1: |
64 cur_req_path = req_path_no_num | 64 cur_req_path = req_path_no_num |
65 | 65 |
66 page = _get_requested_page_for_route(app, route, route_params, | 66 page = _get_requested_page_for_route(app, route, route_params) |
67 route_sub_num) | |
68 if page is not None: | 67 if page is not None: |
69 req_page.page = page | 68 req_page.page = page |
70 req_page.sub_num = route_sub_num | 69 req_page.sub_num = route_sub_num |
71 req_page.req_path = cur_req_path | 70 req_page.req_path = cur_req_path |
72 break | 71 break |
80 | 79 |
81 def _get_requested_page_for_route(app, route, route_params): | 80 def _get_requested_page_for_route(app, route, route_params): |
82 source = app.getSource(route.source_name) | 81 source = app.getSource(route.source_name) |
83 item = source.findContent(route_params) | 82 item = source.findContent(route_params) |
84 if item is not None: | 83 if item is not None: |
85 return app.getPage(item) | 84 return app.getPage(source, item) |
86 return None | 85 return None |
87 | 86 |
88 | 87 |
89 def load_mimetype_map(): | 88 def load_mimetype_map(): |
90 mimetype_map = {} | 89 mimetype_map = {} |