Mercurial > piecrust2
changeset 318:ac9b94c8fb37
internal: Add utility function to get a page from a source.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 28 Mar 2015 14:24:33 -0700 |
parents | 6c5de6edacf7 |
children | 50da3a045d59 |
files | piecrust/sources/base.py |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/piecrust/sources/base.py Sat Mar 28 14:17:50 2015 -0700 +++ b/piecrust/sources/base.py Sat Mar 28 14:24:33 2015 -0700 @@ -93,6 +93,12 @@ def getPages(self): return build_pages(self.app, self.getPageFactories()) + def getPage(self, metadata): + rel_path, metadata = self.findPagePath(metadata, MODE_PARSING) + if rel_path is None: + return None + return Page(self, metadata, rel_path) + def getPageFactories(self): if self._factories is None: self._factories = list(self.buildPageFactories())