Mercurial > piecrust2
diff piecrust/sources/posts.py @ 516:73bd408caebc
internal: Return `None` instead of raising an exception when finding pages.
This makes the `posts` source behave like the other ones.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 27 Jul 2015 00:47:55 -0700 |
parents | dd25bd3ce1f9 |
children | bab91fcef741 |
line wrap: on
line diff
--- a/piecrust/sources/posts.py Sun Jul 26 23:16:15 2015 -0700 +++ b/piecrust/sources/posts.py Mon Jul 27 00:47:55 2015 -0700 @@ -9,7 +9,6 @@ MODE_CREATING, MODE_PARSING) from piecrust.sources.interfaces import IPreparingSource from piecrust.sources.mixins import SimplePaginationSourceMixin -from piecrust.sources.pageref import PageNotFoundError logger = logging.getLogger(__name__) @@ -88,10 +87,10 @@ raise ValueError("Not enough information to find a post path.") possible_paths = glob.glob(path) if len(possible_paths) != 1: - raise PageNotFoundError() + return None path = possible_paths[0] elif mode == MODE_PARSING and not os.path.isfile(path): - raise PageNotFoundError(path) + return None rel_path = os.path.relpath(path, self.fs_endpoint_path) rel_path = rel_path.replace('\\', '/')