Mercurial > piecrust2
diff piecrust/importing/wordpress.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 | 1ddd18ad5e76 |
children | 4850f8c21b6e |
line wrap: on
line diff
--- a/piecrust/importing/wordpress.py Sun Apr 26 08:34:27 2015 -0700 +++ b/piecrust/importing/wordpress.py Sun Apr 26 15:07:40 2015 -0700 @@ -112,7 +112,7 @@ source = self._pages_source else: raise Exception("Unknown post type: %s" % post_info['type']) - rel_path, fac_metadata = source.findPagePath(finder, MODE_CREATING) + factory = source.findPageFactory(finder, MODE_CREATING) metadata = post_info['metadata'].copy() for name in ['title', 'author', 'status', 'post_id', 'post_guid', @@ -129,7 +129,7 @@ status = metadata.get('status') if status == 'publish': - path = source.resolveRef(rel_path) + path = factory.path create_page(self.app, path, metadata, text) elif status == 'draft': filename = '-'.join(metadata['title'].split(' ')) + '.html'