Add feed_written signal

This commit is contained in:
Artemy Tregubenko 2014-07-20 10:54:46 +02:00
commit 0093984861
3 changed files with 4 additions and 0 deletions

View file

@ -101,6 +101,7 @@ static_generator_init static_generator invoked in th
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.
feed_written path, context, feed invoked each time a feed file is written.
================================= ============================ ===========================================================================
The list is currently small, so don't hesitate to add signals and make a pull

View file

@ -44,3 +44,4 @@ content_object_init = signal('content_object_init')
# Writers signals
content_written = signal('content_written')
feed_written = signal('feed_written')

View file

@ -121,6 +121,8 @@ class Writer(object):
with self._open_w(complete_path, encoding) as fp:
feed.write(fp, 'utf-8')
logger.info('Writing %s', complete_path)
signals.feed_written.send(complete_path, context=context, feed=feed)
return feed
finally:
locale.setlocale(locale.LC_ALL, old_locale)