From 30e2cac7539630ba7ad69c548f3551e5a2390721 Mon Sep 17 00:00:00 2001 From: Bernhard Scheirle Date: Thu, 24 Apr 2014 15:30:34 +0200 Subject: [PATCH] send the static_generator_{init, finalized} signals. Note: The two signals were already present but were never sent. --- docs/plugins.rst | 8 ++++++++ pelican/generators.py | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/docs/plugins.rst b/docs/plugins.rst index c03b1251..4e0bdb26 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -87,8 +87,16 @@ get_generators generators invoked in Pe can return a Generator, or several generator in a tuple or in a list. page_generator_context page_generator, metadata +page_generator_preread page_generator invoked before a page is read in PageGenerator.generate_context; + use if code needs to do something before every page is parsed. page_generator_init page_generator invoked in the PagesGenerator.__init__ page_generator_finalized page_generator invoked at the end of PagesGenerator.generate_context +static_generator_context static_generator, metadata +static_generator_preread static_generator invoked before a static file is read in StaticGenerator.generate_context; + use if code needs to do something before every static file is added to the + staticfiles list. +static_generator_init static_generator invoked in the StaticGenerator.__init__ +static_generator_finalized static_generator invoked at the end of StaticGenerator.generate_context content_object_init content_object invoked at the end of Content.__init__ (see note below) content_written path, context invoked each time a content file is written. ================================= ============================ =========================================================================== diff --git a/pelican/generators.py b/pelican/generators.py index bfdac1a5..01f7db8f 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -576,6 +576,10 @@ class StaticGenerator(Generator): """copy static paths (what you want to copy, like images, medias etc. to output""" + def __init__(self, *args, **kwargs): + super(StaticGenerator, self).__init__(*args, **kwargs) + signals.static_generator_init.send(self) + def _copy_paths(self, paths, source, destination, output_path, final_path=None): """Copy all the paths from source to destination""" @@ -604,6 +608,7 @@ class StaticGenerator(Generator): self.staticfiles.append(static) self.add_source_path(static) self._update_context(('staticfiles',)) + signals.static_generator_finalized.send(self) def generate_output(self, writer): self._copy_paths(self.settings['THEME_STATIC_PATHS'], self.theme,