comparison piecrust/serving/server.py @ 853:f070a4fc033c

core: Continue PieCrust3 refactor, simplify pages. The asset pipeline is still the only function pipeline at this point. * No more `QualifiedPage`, and several other pieces of code deleted. * Data providers are simpler and more focused. For instance, the page iterator doesn't try to support other types of items. * Route parameters are proper known source metadata to remove the confusion between the two. * Make the baker and pipeline more correctly manage records and record histories. * Add support for record collapsing and deleting stale outputs in the asset pipeline.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 21 May 2017 00:06:59 -0700
parents 4850f8c21b6e
children 08e02c2a2a1a
comparison
equal deleted inserted replaced
852:4850f8c21b6e 853:f070a4fc033c
158 # Find a matching page. 158 # Find a matching page.
159 req_page = get_requested_page(app, request.path) 159 req_page = get_requested_page(app, request.path)
160 160
161 # If we haven't found any good match, report all the places we didn't 161 # If we haven't found any good match, report all the places we didn't
162 # find it at. 162 # find it at.
163 qp = req_page.qualified_page 163 if req_page.page is None:
164 if qp is None:
165 msg = "Can't find path for '%s':" % request.path 164 msg = "Can't find path for '%s':" % request.path
166 raise MultipleNotFound(msg, req_page.not_found_errors) 165 raise MultipleNotFound(msg, req_page.not_found_errors)
167 166
168 # We have a page, let's try to render it. 167 # We have a page, let's try to render it.
169 render_ctx = RenderingContext(qp, force_render=True) 168 render_ctx = RenderingContext(req_page,
170 qp.page.source.prepareRenderContext(render_ctx) 169 sub_num=req_page.sub_num,
170 force_render=True)
171 req_page.page.source.prepareRenderContext(render_ctx)
171 172
172 # Render the page. 173 # Render the page.
173 rendered_page = render_page(render_ctx) 174 rendered_page = render_page(render_ctx)
174 175
175 # Start doing stuff. 176 # Start doing stuff.