Skip to content

Commit 7670c14

Browse files
authoredDec 25, 2016
Merge pull request #2607 from getnikola/adding-more-signal-handlers
Adding/extending signal handlers.
2 parents 6076df5 + 7318d12 commit 7670c14

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed
 

‎nikola/nikola.py

+8
Original file line numberDiff line numberDiff line change
@@ -2167,6 +2167,14 @@ def generic_page_renderer(self, lang, post, filters, context=None):
21672167
if post:
21682168
deps_dict['post_translations'] = post.translated_to
21692169

2170+
signal('render_post').send({
2171+
'site': self,
2172+
'post': post,
2173+
'lang': lang,
2174+
'context': context,
2175+
'deps_dict': deps_dict,
2176+
})
2177+
21702178
yield self.generic_renderer(lang, output_name, post.template_name, filters,
21712179
file_deps=deps,
21722180
uptodate_deps=uptodate_deps,

‎nikola/plugins/misc/taxonomies_classifier.py

+1
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ def create_hierarchy(hierarchy, parent=None, level=0):
192192
taxonomy_outputs[lang][path] = (taxonomy.classification_name, classification, list(posts))
193193
if quit:
194194
sys.exit(1)
195+
blinker.signal('taxonomies_classified').send(site)
195196

196197
def _get_filtered_list(self, taxonomy, classification, lang):
197198
"""Return the filtered list of posts for this classification and language."""

‎nikola/plugins/task/taxonomies.py

+18
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"""Render the taxonomy overviews, classification pages and feeds."""
2828

2929
from __future__ import unicode_literals
30+
import blinker
3031
import os
3132
import natsort
3233
from copy import copy
@@ -118,6 +119,14 @@ def _render_classification_overview(self, classification_name, template, lang, c
118119
if "pagekind" not in context:
119120
context["pagekind"] = ["list", "tags_page"]
120121
output_name = os.path.join(self.site.config['OUTPUT_FOLDER'], self.site.path('{}_index'.format(classification_name), None, lang))
122+
blinker.signal('generate_classification_overview').send({
123+
'site': self.site,
124+
'classification_name': classification_name,
125+
'lang': lang,
126+
'context': context,
127+
'kw': kw,
128+
'output_name': output_name,
129+
})
121130
task = self.site.generic_post_list_renderer(
122131
lang,
123132
[],
@@ -322,6 +331,15 @@ def _generate_classification_page(self, taxonomy, classification, post_list, lan
322331
kw["index_file"] = self.site.config['INDEX_FILE']
323332
context = copy(context)
324333
context["permalink"] = self.site.link(taxonomy.classification_name, classification, lang)
334+
blinker.signal('generate_classification_page').send({
335+
'site': self.site,
336+
'taxonomy': taxonomy,
337+
'classification': classification,
338+
'lang': lang,
339+
'posts': filtered_posts,
340+
'context': context,
341+
'kw': kw,
342+
})
325343
# Decide what to do
326344
if taxonomy.has_hierarchy and taxonomy.show_list_as_subcategories_list:
327345
# Determine whether there are subcategories

‎nikola/post.py

+1
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,7 @@ def wrap_encrypt(path, password):
552552
'source': self.translated_source_path(lang),
553553
'dest': dest,
554554
'post': self,
555+
'lang': lang,
555556
})
556557

557558
if self.meta('password'):

0 commit comments

Comments
 (0)
Please sign in to comment.