Mercurial > piecrust2
diff piecrust/sources/base.py @ 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 | 88bffd469b04 |
children | dd25bd3ce1f9 |
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())