Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Forcing destination_base to be a TranslatableSetting.
  • Loading branch information
felixfontein committed Oct 9, 2016
1 parent e1573a5 commit 936a4de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion nikola/plugins/misc/scan_posts.py
Expand Up @@ -53,6 +53,7 @@ def scan(self):
self.site.config['post_pages']:
if not self.site.quiet:
print(".", end='', file=sys.stderr)
destination_translatable = utils.TranslatableSetting(destination)
dirname = os.path.dirname(wildcard)
for dirpath, _, _ in os.walk(dirname, followlinks=True):
rel_dest_dir = os.path.relpath(dirpath, dirname)
Expand Down Expand Up @@ -94,7 +95,7 @@ def scan(self):
self.site.MESSAGES,
template_name,
self.site.get_compiler(base_path),
destination_base=destination
destination_base=destination_translatable
)
timeline.append(post)

Expand Down
6 changes: 3 additions & 3 deletions nikola/post.py
Expand Up @@ -95,6 +95,8 @@ def __init__(
The source path is the user created post file. From it we calculate
the meta file, as well as any translations available, and
the .html fragment file path.
destination_base must be None or an TranslatableSetting instance
"""
self.config = config
self.compiler = compiler
Expand Down Expand Up @@ -165,9 +167,7 @@ def __init__(

# Find paths from metadata
self.folders = {lang: self.folder_relative for lang in self.config['TRANSLATIONS'].keys()}
if isinstance(self.folder_base, (utils.bytes_str, utils.unicode_str)):
self.folders = {lang: os.path.normpath(os.path.join(self.folder_base, folder)) for lang, folder in self.folders.items()}
elif self.folder_base is not None:
if self.folder_base is not None:
self.folders = {lang: os.path.normpath(os.path.join(self.folder_base(lang), folder)) for lang, folder in self.folders.items()}
self.folder = self.folders[self.default_lang]

Expand Down

0 comments on commit 936a4de

Please sign in to comment.