Mercurial > piecrust2
comparison piecrust/commands/builtin/scaffolding.py @ 363:dd25bd3ce1f9
serve: Refactoring and fixes to be able to serve taxonomy pages.
* Page sources' `findPagePath` is renamed to `findPageFactory`, so that it
also returns source metadata.
* Page refs now store possible hits more properly, and use the previous point
to also store metadata. As a result, they can also return a proper factory.
* Implement `findPageFactory` correctly in all built-in sources.
* When the Chef server matches a taxonomy page, get the source metadata from
the page ref in order to make a more proper page.
* Make the `getRoute(s)` functions explicitely say if they want taxonomy routes
or not.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 26 Apr 2015 15:07:40 -0700 |
parents | f130365568ff |
children | 5bbeb11fe8d9 |
comparison
equal
deleted
inserted
replaced
362:ff595828a364 | 363:dd25bd3ce1f9 |
---|---|
62 "Please run `chef prepare -h` for usage.") | 62 "Please run `chef prepare -h` for usage.") |
63 | 63 |
64 app = ctx.app | 64 app = ctx.app |
65 source = ctx.args.source | 65 source = ctx.args.source |
66 metadata = source.buildMetadata(ctx.args) | 66 metadata = source.buildMetadata(ctx.args) |
67 rel_path, metadata = source.findPagePath(metadata, MODE_CREATING) | 67 factory = source.findPageFactory(metadata, MODE_CREATING) |
68 path = source.resolveRef(rel_path) | 68 path = factory.path |
69 name, ext = os.path.splitext(path) | 69 name, ext = os.path.splitext(path) |
70 if ext == '.*': | 70 if ext == '.*': |
71 path = '%s.%s' % ( | 71 path = '%s.%s' % ( |
72 name, | 72 name, |
73 app.config.get('site/default_auto_format')) | 73 app.config.get('site/default_auto_format')) |