Skip to content

Commit

Permalink
Only rebuild changed tags when changing tag descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
da2x committed Jun 18, 2015
1 parent 6f3002a commit c66282a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -15,6 +15,7 @@ Features
Bugfixes
--------

* Don’t rebuild all tag or category pages when changing tag/category descriptions
* Fix crash in wordpress code importer (Issue #1819)
* Call correct command in ``nikola auto``

Expand Down
10 changes: 4 additions & 6 deletions nikola/plugins/task/tags.py
Expand Up @@ -67,11 +67,9 @@ def gen_tasks(self):
"filters": self.site.config['FILTERS'],
'tag_path': self.site.config['TAG_PATH'],
"tag_pages_are_indexes": self.site.config['TAG_PAGES_ARE_INDEXES'],
"tag_pages_descriptions": self.site.config['TAG_PAGES_DESCRIPTIONS'],
'category_path': self.site.config['CATEGORY_PATH'],
'category_prefix': self.site.config['CATEGORY_PREFIX'],
"category_pages_are_indexes": self.site.config['CATEGORY_PAGES_ARE_INDEXES'],
"category_pages_descriptions": self.site.config['CATEGORY_PAGES_DESCRIPTIONS'],
"generate_rss": self.site.config['GENERATE_RSS'],
"rss_teasers": self.site.config["RSS_TEASERS"],
"rss_plain": self.site.config["RSS_PLAIN"],
Expand Down Expand Up @@ -247,8 +245,8 @@ def _get_title(self, tag, is_category):
else:
return tag

def _get_description(self, tag, is_category, kw, lang):
descriptions = kw["category_pages_descriptions"] if is_category else kw["tag_pages_descriptions"]
def _get_description(self, tag, is_category, lang):
descriptions = self.site.config['CATEGORY_PAGES_DESCRIPTIONS'] if is_category else self.site.config['TAG_PAGES_DESCRIPTIONS']
return descriptions[lang][tag] if lang in descriptions and tag in descriptions[lang] else None

def _get_subcategories(self, category):
Expand Down Expand Up @@ -283,7 +281,7 @@ def page_path(i, displayed_i, num_pages, force_addition, extension=None):
context_source["category_path"] = self.site.parse_category_name(tag)
context_source["tag"] = title
indexes_title = kw["messages"][lang]["Posts about %s"] % title
context_source["description"] = self._get_description(tag, is_category, kw, lang)
context_source["description"] = self._get_description(tag, is_category, lang)
if is_category:
context_source["subcategories"] = self._get_subcategories(tag)
template_name = "tagindex.tmpl"
Expand All @@ -307,7 +305,7 @@ def tag_page_as_list(self, tag, lang, post_list, kw, is_category):
context["posts"] = post_list
context["permalink"] = self.site.link(kind, tag, lang)
context["kind"] = kind
context["description"] = self._get_description(tag, is_category, kw, lang)
context["description"] = self._get_description(tag, is_category, lang)
if is_category:
context["subcategories"] = self._get_subcategories(tag)
task = self.site.generic_post_list_renderer(
Expand Down

0 comments on commit c66282a

Please sign in to comment.