From 774d3eb577ef3b3a3ccf2a93990aac4da5bd34e6 Mon Sep 17 00:00:00 2001 From: Chris Warrick Date: Wed, 15 Mar 2017 20:22:16 +0100 Subject: [PATCH] Fix #216 -- fix default value for a navstories config variable Signed-off-by: Chris Warrick --- v7/navstories/README.md | 2 ++ v7/navstories/navstories.plugin | 2 +- v7/navstories/navstories.py | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/v7/navstories/README.md b/v7/navstories/README.md index ec63583e..25baac24 100644 --- a/v7/navstories/README.md +++ b/v7/navstories/README.md @@ -41,6 +41,8 @@ NAVSTORIES_SUBMENU_INDENTION = '* ' # Static menu after dynamic navstories menu entries # Format just as NAVIGATION_LINKS, but content included after navstories entries NAVIGATION_LINKS_POST_NAVSTORIES = { + DEFAULT_LANG: ( + ), } ``` diff --git a/v7/navstories/navstories.plugin b/v7/navstories/navstories.plugin index 3fde7fb9..a2a2c83c 100644 --- a/v7/navstories/navstories.plugin +++ b/v7/navstories/navstories.plugin @@ -8,6 +8,6 @@ MinVersion = 7.1.0+ [Documentation] Author = Chris Warrick, Benny Simonsen -Version = 1.0.1 +Version = 1.0.2 Website = http://plugins.getnikola.com/#navstories Description = Add all stories in specified locations to the navigation bar. diff --git a/v7/navstories/navstories.py b/v7/navstories/navstories.py index 22023083..633f7b9c 100644 --- a/v7/navstories/navstories.py +++ b/v7/navstories/navstories.py @@ -39,6 +39,7 @@ class NavStories(ConfigPlugin): dates = {} conf_vars = ['TRANSLATIONS', 'NAVSTORIES_PATHS', 'NAVSTORIES_MAPPING', 'NAVIGATION_LINKS_POST_NAVSTORIES'] + conf_defaults = {'TRANSLATIONS': dict, 'NAVSTORIES_PATHS': dict, 'NAVSTORIES_MAPPING': dict, 'NAVIGATION_LINKS_POST_NAVSTORIES': tuple} # Indention for each level deeper in a submenu, than the highest level in that submenu # overwriiten by site.config['NAVSTORIES_SUBMENU_INDENTION'] if defined @@ -130,7 +131,7 @@ def set_site(self, site): nav_config[i] = utils.TranslatableSetting(i, site.config[i], site.config['TRANSLATIONS']) except KeyError: # Initialize to "empty" in case config variable i is missing - nav_config[i] = utils.TranslatableSetting(i, {}, site.config['TRANSLATIONS']) + nav_config[i] = utils.TranslatableSetting(i, self.conf_defaults[i](), site.config['TRANSLATIONS']) site.scan_posts() # NAVIGATION_LINKS is a TranslatableSetting, values is an actual dict