Skip to content
Permalink
Browse files

Fixing #2109: path bug in get_asset_path and wrong documentation.

  • Loading branch information...
felixfontein committed Sep 22, 2015
1 parent e051a1d commit f173fca4d08304ee080f9b5d890e4ea4c3386f07
Showing with 9 additions and 4 deletions.
  1. +9 −4 nikola/utils.py
@@ -986,9 +986,12 @@ def get_asset_path(path, themes, files_folders={'files': ''}, _themes_dir='theme
>>> print(get_asset_path('nikola.py', ['bootstrap3', 'base'], {'nikola': ''}))
/.../nikola/nikola.py
>>> print(get_asset_path('nikola/nikola.py', ['bootstrap3', 'base'], {'nikola':'nikola'}))
>>> print(get_asset_path('nikola.py', ['bootstrap3', 'base'], {'nikola': 'nikola'}))
None
>>> print(get_asset_path('nikola/nikola.py', ['bootstrap3', 'base'], {'nikola': 'nikola'}))
/.../nikola/nikola.py
"""
for theme_name in themes:
candidate = os.path.join(
@@ -998,9 +1001,11 @@ def get_asset_path(path, themes, files_folders={'files': ''}, _themes_dir='theme
if os.path.isfile(candidate):
return candidate
for src, rel_dst in files_folders.items():
candidate = os.path.abspath(os.path.join(src, path))
if os.path.isfile(candidate):
return candidate
relpath = os.path.relpath(path, rel_dst)
if not relpath.startswith('..' + os.path.sep):
candidate = os.path.abspath(os.path.join(src, relpath))
if os.path.isfile(candidate):
return candidate

if output_dir:
candidate = os.path.join(output_dir, path)

0 comments on commit f173fca

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.