diff options
Diffstat (limited to 'view_functions.py')
-rw-r--r-- | view_functions.py | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/view_functions.py b/view_functions.py index 64dcfe0..f86952d 100644 --- a/view_functions.py +++ b/view_functions.py @@ -4,7 +4,6 @@ about files and paths. """ import os from siteconfig import siteconfig -from server import app def default_context(): @@ -14,8 +13,8 @@ def default_context(): make up the navbar """ return { - 'domain': app.config['DOMAIN'], - 'navbar': sorted(app.config['MAIN_SITE_DIRS']), + 'domain': siteconfig.DOMAIN, + 'navbar': siteconfig.MAIN_SITE_DIRS, } @@ -49,14 +48,10 @@ def index_dir(path): links = f.readlines() elif obj == siteconfig.DESC_FILE: description = True - elif obj.startswith('.'): - continue - else: + elif not obj.startswith('.'): files.append(obj) elif os.path.isdir(path + '/' + obj): - if obj.startswith('.'): - continue - else: + if not obj.startswith('.'): dirs.append(obj) return sorted(dirs), sorted(files), sorted(links), description @@ -64,8 +59,10 @@ def index_dir(path): def is_hidden_path(path): """ - Tests if last object specified in `path` is hidden. - Inspired by Unix. On Windows, directories won't actually be "hidden" but - they are still not indexed by this program + Tests if the URI path requested by the user, has any hidden paths + which should not be rendered """ - return path.split('/')[-1].startswith('.') + for d in path.split('/'): + if d.startswith('.'): + return True + return False |