Mercurial > piecrust2
diff piecrust/sources/blogarchives.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 | 9bb22bbe093c |
line wrap: on
line diff
--- a/piecrust/sources/blogarchives.py Sun May 21 00:06:59 2017 -0700 +++ b/piecrust/sources/blogarchives.py Sun Jun 04 23:34:28 2017 -0700 @@ -2,7 +2,8 @@ import datetime from piecrust.chefutil import format_timed_scope from piecrust.data.filters import PaginationFilter, IFilterClause -from piecrust.dataproviders.page_iterator import PageIterator +from piecrust.dataproviders.pageiterator import PageIterator +from piecrust.pipelines.base import ContentPipeline from piecrust.routing import RouteParameter from piecrust.sources.base import ContentSource, GeneratedContentException @@ -12,6 +13,7 @@ class BlogArchivesSource(ContentSource): SOURCE_NAME = 'blog_archives' + DEFAULT_PIPELINE_NAME = 'blog_archives' def __init__(self, app, name, config): super().__init__(app, name, config) @@ -124,3 +126,7 @@ def _date_sorter(it): return sorted(it, key=lambda x: x.datetime) + +class BlogArchivesPipeline(ContentPipeline): + PIPELINE_NAME = 'blog_archives' + PASS_NUM = 1