Skip to content

Commit

Permalink
Fix #2325 -- fix tag duplicate search
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Apr 22, 2016
1 parent 947b745 commit 806425c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGES.txt
Expand Up @@ -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)
Expand Down
9 changes: 2 additions & 7 deletions nikola/nikola.py
Expand Up @@ -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]:
Expand All @@ -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'))

Expand Down

0 comments on commit 806425c

Please sign in to comment.