Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
give meaningful error if two posts conflict (Fix #1749)
  • Loading branch information
ralsina committed May 23, 2015
1 parent 708c176 commit 22065e2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -14,6 +14,7 @@ Features
Bugfixes
--------

* Better error if two posts/pages output conflict (Issue #1749)
* Scanning of posts refactored out of core (Issue #1700)
* github_deploy records lastdeploy timestamp like regular deploy
* Use a global directory for gallery images, ignoring translations (Issue #1726)
Expand Down
18 changes: 16 additions & 2 deletions nikola/nikola.py
Expand Up @@ -1463,8 +1463,22 @@ def scan_posts(self, really=False, ignore_quit=False, quiet=False):
self.pages.append(post)

for lang in self.config['TRANSLATIONS'].keys():
self.post_per_file[post.destination_path(lang=lang)] = post
self.post_per_file[post.destination_path(lang=lang, extension=post.source_ext())] = post
dest = post.destination_path(lang=lang)
src_dest = post.destination_path(lang=lang, extension=post.source_ext())
if dest in self.post_per_file:
utils.LOGGER.error('Two posts are trying to generate {0}: {1} and {2}'.format(
dest,
self.post_per_file[dest].source_path,
post.source_path))
sys.exit(1)
if (src_dest in self.post_per_file) and self.config['COPY_SOURCES']:
utils.LOGGER.error('Two posts are trying to generate {0}: {1} and {2}'.format(
src_dest,
self.post_per_file[dest].source_path,
post.source_path))
sys.exit(1)
self.post_per_file[dest] = post
self.post_per_file[src_dest] = post

# Sort everything.

Expand Down

0 comments on commit 22065e2

Please sign in to comment.