Skip to content
Permalink
Browse files

Fix #2325 -- fix tag duplicate search

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Apr 22, 2016
1 parent 947b745 commit 806425cd0b6902459e297b2984e8e7881309a22d
Showing with 4 additions and 8 deletions.
  1. +2 −1 CHANGES.txt
  2. +2 −7 nikola/nikola.py
@@ -9,7 +9,8 @@ Features
Bugfixes
--------

* Warn if a tag appears multiple times in a post (Issue #2315)
* Show “tags too similar” error instead of cryptic doit crash (Issue #2325)
* Fix crashes when tag appears multiple times in a post (Issue #2315)
* Use binary I/O for ``.svg`` files in galleries
* Accept ``.svgz`` extension by default
* Don't randomly load plugins when Nikola is called with no arguments (Issue #2297)
@@ -1746,10 +1746,7 @@ def scan_posts(self, really=False, ignore_quit=False, quiet=False):
self.posts_per_year[str(post.date.year)].append(post)
self.posts_per_month[
'{0}/{1:02d}'.format(post.date.year, post.date.month)].append(post)
for tag in post.alltags:
self.posts_per_tag[tag].append(post)
for lang in self.config['TRANSLATIONS'].keys():
_tags_for_post = []
for tag in post.tags_for_language(lang):
_tag_slugified = utils.slugify(tag, lang)
if _tag_slugified in slugged_tags[lang]:
@@ -1760,12 +1757,10 @@ def scan_posts(self, really=False, ignore_quit=False, quiet=False):
utils.LOGGER.error('Tag {0} is used in: {1}'.format(tag, post.source_path))
utils.LOGGER.error('Tag {0} is used in: {1}'.format(other_tag, ', '.join([p.source_path for p in self.posts_per_tag[other_tag]])))
quit = True
elif _tag_slugified in _tags_for_post:
utils.LOGGER.error("The tag {0} ({1}) appears more than once in post {2}.".format(tag, _tag_slugified, post.source_path))
quit = True
else:
slugged_tags[lang].add(_tag_slugified)
_tags_for_post.append(_tag_slugified)
if post not in self.posts_per_tag[tag]:
self.posts_per_tag[tag].append(post)
self.tags_per_language[lang].extend(post.tags_for_language(lang))
self._add_post_to_category(post, post.meta('category'))

0 comments on commit 806425c

Please sign in to comment.
You can’t perform that action at this time.