Mercurial > piecrust2
diff piecrust/data/linker.py @ 852:4850f8c21b6e
core: Start of the big refactor for PieCrust 3.0.
* Everything is a `ContentSource`, including assets directories.
* Most content sources are subclasses of the base file-system source.
* A source is processed by a "pipeline", and there are 2 built-in pipelines,
one for assets and one for pages. The asset pipeline is vaguely functional,
but the page pipeline is completely broken right now.
* Rewrite the baking process as just running appropriate pipelines on each
content item. This should allow for better parallelization.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 17 May 2017 00:11:48 -0700 |
parents | 3cca1f6bd610 |
children | f070a4fc033c |
line wrap: on
line diff
--- a/piecrust/data/linker.py Sat Apr 29 21:42:22 2017 -0700 +++ b/piecrust/data/linker.py Wed May 17 00:11:48 2017 -0700 @@ -3,7 +3,7 @@ from piecrust.data.iterators import PageIterator from piecrust.data.pagedata import LazyPageConfigLoaderHasNoValue from piecrust.data.paginationdata import PaginationData -from piecrust.sources.interfaces import IPaginationSource, IListableSource +from piecrust.sources.interfaces import IPaginationSource logger = logging.getLogger(__name__) @@ -11,17 +11,17 @@ class PageLinkerData(object): """ Entry template data to get access to related pages from a given - root page. + root page. """ debug_render = ['parent', 'ancestors', 'siblings', 'children', 'root', 'forpath'] debug_render_invoke = ['parent', 'ancestors', 'siblings', 'children', 'root'] debug_render_redirect = { - 'ancestors': '_debugRenderAncestors', - 'siblings': '_debugRenderSiblings', - 'children': '_debugRenderChildren', - 'root': '_debugRenderRoot'} + 'ancestors': '_debugRenderAncestors', + 'siblings': '_debugRenderSiblings', + 'children': '_debugRenderChildren', + 'root': '_debugRenderRoot'} def __init__(self, source, page_path): self._source = source @@ -82,10 +82,6 @@ self._is_loaded = True - is_listable = isinstance(self._source, IListableSource) - if not is_listable: - return - dir_path = self._source.getDirpath(self._root_page_path) self._linker = Linker(self._source, dir_path, root_page_path=self._root_page_path) @@ -260,8 +256,8 @@ item = _LinkedPage(parent_page) item._linker_info.name = parent_name item._linker_info.child_linker = Linker( - self._source, parent_dir_path, - root_page_path=self._root_page_path) + self._source, parent_dir_path, + root_page_path=self._root_page_path) self._parent = LinkedPageData(item) break else: @@ -308,10 +304,6 @@ if self._items is not None: return - is_listable = isinstance(self._source, IListableSource) - if not is_listable: - raise Exception("Source '%s' can't be listed." % self._source.name) - items = list(self._source.listPath(self._dir_path)) self._items = collections.OrderedDict() for is_dir, name, data in items: