mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Don't pollute STDOUT with skipped files
This commit is contained in:
parent
990f69cfca
commit
07f50e5786
2 changed files with 24 additions and 11 deletions
|
|
@ -14,7 +14,7 @@ from jinja2 import (BaseLoader, ChoiceLoader, Environment, FileSystemLoader,
|
|||
from pelican.cache import FileStampDataCacher
|
||||
from pelican.contents import Article, Page, Static
|
||||
from pelican.plugins import signals
|
||||
from pelican.readers import Readers
|
||||
from pelican.readers import PelicanFileSkipped, Readers
|
||||
from pelican.utils import (DateFormatter, copy, mkdir_p, order_content,
|
||||
posixize_path, process_translations)
|
||||
|
||||
|
|
@ -621,9 +621,12 @@ class ArticlesGenerator(CachingGenerator):
|
|||
context_signal=signals.article_generator_context,
|
||||
context_sender=self)
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
'Could not process %s\n%s', f, e,
|
||||
exc_info=self.settings.get('DEBUG', False))
|
||||
if isinstance(e, PelicanFileSkipped):
|
||||
logger.debug('Skipping %s', f)
|
||||
else:
|
||||
logger.error(
|
||||
'Could not process %s\n%s', f, e,
|
||||
exc_info=self.settings.get('DEBUG', False))
|
||||
self._add_failed_source_path(f)
|
||||
continue
|
||||
|
||||
|
|
@ -726,9 +729,12 @@ class PagesGenerator(CachingGenerator):
|
|||
context_signal=signals.page_generator_context,
|
||||
context_sender=self)
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
'Could not process %s\n%s', f, e,
|
||||
exc_info=self.settings.get('DEBUG', False))
|
||||
if isinstance(e, PelicanFileSkipped):
|
||||
logger.debug('Skipping %s', f)
|
||||
else:
|
||||
logger.error(
|
||||
'Could not process %s\n%s', f, e,
|
||||
exc_info=self.settings.get('DEBUG', False))
|
||||
self._add_failed_source_path(f)
|
||||
continue
|
||||
|
||||
|
|
@ -817,9 +823,12 @@ class StaticGenerator(Generator):
|
|||
context_signal=signals.static_generator_context,
|
||||
context_sender=self)
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
'Could not process %s\n%s', f, e,
|
||||
exc_info=self.settings.get('DEBUG', False))
|
||||
if isinstance(e, PelicanFileSkipped):
|
||||
logger.debug('Skipping %s', f)
|
||||
else:
|
||||
logger.error(
|
||||
'Could not process %s\n%s', f, e,
|
||||
exc_info=self.settings.get('DEBUG', False))
|
||||
self._add_failed_source_path(f, static=True)
|
||||
continue
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,10 @@ METADATA_PROCESSORS = {
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PelicanFileSkipped(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def ensure_metadata_list(text):
|
||||
"""Canonicalize the format of a list of authors or tags. This works
|
||||
the same way as Docutils' "authors" field: if it's already a list,
|
||||
|
|
@ -538,7 +542,7 @@ class Readers(FileStampDataCacher):
|
|||
path = os.path.abspath(os.path.join(base_path, path))
|
||||
source_path = posixize_path(os.path.relpath(path, base_path))
|
||||
if 'READ_SELECTED' in self.settings and self.settings['READ_SELECTED'] not in source_path:
|
||||
raise ValueError(f"Skipping {source_path}")
|
||||
raise PelicanFileSkipped(source_path)
|
||||
logger.debug(
|
||||
'Read file %s -> %s',
|
||||
source_path, content_class.__name__)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue