Skip to content

Commit

Permalink
Don't use Post.source_path directly to determine translated post's so…
Browse files Browse the repository at this point in the history
…urce file name. Allowing Post.translated_source_path() to return None.
  • Loading branch information
felixfontein committed Feb 16, 2017
1 parent e8dab6d commit 147dc60
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 2 additions & 1 deletion nikola/nikola.py
Expand Up @@ -2094,7 +2094,8 @@ def scan_posts(self, really=False, ignore_quit=False, quiet=False):
quit = True
self.post_per_file[dest] = post
self.post_per_file[src_dest] = post
self.post_per_input_file[src_file] = post
if src_file is not None:
self.post_per_input_file[src_file] = post
# deduplicate tags_per_language
self.tags_per_language[lang] = list(set(self.tags_per_language[lang]))

Expand Down
8 changes: 2 additions & 6 deletions nikola/plugins/task/sources.py
Expand Up @@ -61,12 +61,8 @@ def gen_tasks(self):
# do not publish PHP sources
if post.source_ext(True) == post.compiler.extension():
continue
source = post.source_path
if lang != kw["default_lang"]:
source_lang = utils.get_translation_candidate(self.site.config, source, lang)
if os.path.exists(source_lang):
source = source_lang
if os.path.isfile(source):
source = post.translated_source_path(lang)
if source is not None and os.path.isfile(source):
yield {
'basename': 'render_sources',
'name': os.path.normpath(output_name),
Expand Down

0 comments on commit 147dc60

Please sign in to comment.