Mercurial > piecrust2
diff piecrust/sources/posts.py @ 84:b3ce11b2cf36
Don't complain about missing `pages` or `posts` directories by default.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 03 Sep 2014 17:26:38 -0700 |
parents | 838a9dd0e23c |
children | cb6eadea0845 |
line wrap: on
line diff
--- a/piecrust/sources/posts.py Mon Sep 01 14:54:34 2014 -0700 +++ b/piecrust/sources/posts.py Wed Sep 03 17:26:38 2014 -0700 @@ -137,7 +137,10 @@ def _checkFsEndpointPath(self): if not os.path.isdir(self.fs_endpoint_path): + if self.ignore_missing_dir: + return False raise InvalidFileSystemEndpointError(self.name, self.fs_endpoint_path) + return True def _makeFactory(self, path, slug, year, month, day): path = path.replace('\\', '/') @@ -159,6 +162,8 @@ super(FlatPostsSource, self).__init__(app, name, config) def buildPageFactories(self): + if not self._checkFsEndpointPath(): + return logger.debug("Scanning for posts (flat) in: %s" % self.fs_endpoint_path) pattern = re.compile(r'(\d{4})-(\d{2})-(\d{2})_(.*)\.(\w+)$') _, __, filenames = next(os.walk(self.fs_endpoint_path)) @@ -185,6 +190,8 @@ super(ShallowPostsSource, self).__init__(app, name, config) def buildPageFactories(self): + if not self._checkFsEndpointPath(): + return logger.debug("Scanning for posts (shallow) in: %s" % self.fs_endpoint_path) year_pattern = re.compile(r'(\d{4})$') file_pattern = re.compile(r'(\d{2})-(\d{2})_(.*)\.(\w+)$') @@ -222,6 +229,8 @@ super(HierarchyPostsSource, self).__init__(app, name, config) def buildPageFactories(self): + if not self._checkFsEndpointPath(): + return logger.debug("Scanning for posts (hierarchy) in: %s" % self.fs_endpoint_path) year_pattern = re.compile(r'(\d{4})$') month_pattern = re.compile(r'(\d{2})$')