Mercurial > piecrust2
comparison piecrust/baking/baker.py @ 369:4b1019bb2533
serve: Giant refactor to change how we handle data when serving pages.
* We need a distinction between source metadata and route metadata. In most
cases they're the same, but in cases like taxonomy pages, route metadata
contains more things that can't be in source metadata if we want to re-use
cached pages.
* Create a new `QualifiedPage` type which is a page with a specific route
and route metadata. Pass this around in many places.
* Instead of passing an URL around, use the route in the `QualifiedPage` to
generate URLs. This is better since it removes the guess-work from trying
to generate URLs for sub-pages.
* Deep-copy app and page configurations before passing them around to things
that could modify them, like data builders and such.
* Exclude taxonomy pages from iterator data providers.
* Properly nest iterator data providers for when the theme and user page
sources are merged inside `site.pages`.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 03 May 2015 18:47:10 -0700 |
parents | dd25bd3ce1f9 |
children | c2ca72fb7f0b |
comparison
equal
deleted
inserted
replaced
368:2408eb6f4da8 | 369:4b1019bb2533 |
---|---|
275 logger.debug( | 275 logger.debug( |
276 "No taxonomy page found at '%s', skipping." % | 276 "No taxonomy page found at '%s', skipping." % |
277 tax.page_ref) | 277 tax.page_ref) |
278 continue | 278 continue |
279 | 279 |
280 tax_page_source = tax_page_ref.source | |
281 tax_page_rel_path = tax_page_ref.rel_path | |
282 logger.debug( | 280 logger.debug( |
283 "Using taxonomy page: %s:%s" % | 281 "Using taxonomy page: %s:%s" % |
284 (tax_page_source.name, tax_page_rel_path)) | 282 (tax_page_ref.source_name, tax_page_ref.rel_path)) |
285 | |
286 for term in terms: | 283 for term in terms: |
287 fac = PageFactory( | 284 fac = tax_page_ref.getFactory() |
288 tax_page_source, tax_page_rel_path, | |
289 {tax.term_name: term}) | |
290 logger.debug( | 285 logger.debug( |
291 "Queuing: %s [%s, %s]" % | 286 "Queuing: %s [%s=%s]" % |
292 (fac.ref_spec, tax_name, term)) | 287 (fac.ref_spec, tax_name, term)) |
293 entry = BakeRecordPageEntry( | 288 entry = BakeRecordPageEntry( |
294 fac.source.name, fac.rel_path, fac.path, | 289 fac.source.name, fac.rel_path, fac.path, |
295 (tax_name, term, source_name)) | 290 (tax_name, term, source_name)) |
296 record.addEntry(entry) | 291 record.addEntry(entry) |