mirror of
https://github.com/getpelican/pelican.git
synced 2026-05-27 17:46:18 +02:00
[WIP] Read content selectively
This commit is contained in:
parent
7a26f509df
commit
990f69cfca
2 changed files with 17 additions and 7 deletions
|
|
@ -808,13 +808,21 @@ class StaticGenerator(Generator):
|
||||||
if self._is_potential_source_path(f):
|
if self._is_potential_source_path(f):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
static = self.readers.read_file(
|
try:
|
||||||
base_path=self.path, path=f, content_class=Static,
|
static = self.readers.read_file(
|
||||||
fmt='static', context=self.context,
|
base_path=self.path, path=f, content_class=Static,
|
||||||
preread_signal=signals.static_generator_preread,
|
fmt='static', context=self.context,
|
||||||
preread_sender=self,
|
preread_signal=signals.static_generator_preread,
|
||||||
context_signal=signals.static_generator_context,
|
preread_sender=self,
|
||||||
context_sender=self)
|
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))
|
||||||
|
self._add_failed_source_path(f, static=True)
|
||||||
|
continue
|
||||||
|
|
||||||
self.staticfiles.append(static)
|
self.staticfiles.append(static)
|
||||||
self.add_source_path(static, static=True)
|
self.add_source_path(static, static=True)
|
||||||
self._update_context(('staticfiles',))
|
self._update_context(('staticfiles',))
|
||||||
|
|
|
||||||
|
|
@ -537,6 +537,8 @@ class Readers(FileStampDataCacher):
|
||||||
|
|
||||||
path = os.path.abspath(os.path.join(base_path, path))
|
path = os.path.abspath(os.path.join(base_path, path))
|
||||||
source_path = posixize_path(os.path.relpath(path, base_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}")
|
||||||
logger.debug(
|
logger.debug(
|
||||||
'Read file %s -> %s',
|
'Read file %s -> %s',
|
||||||
source_path, content_class.__name__)
|
source_path, content_class.__name__)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue