diff --git a/pelican/settings.py b/pelican/settings.py index 11d6d9ef..dda1e3fc 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -529,17 +529,18 @@ def configure_settings(settings): preserved = {} logger.debug('Theme provides a config `%s`', theme_config) # preserve variables that are dynamically calculated in read_settings() - for p in ['PATH', 'OUTPUT_PATH', 'THEME', 'CACHE_PATH', 'PLUGIN_PATHS']: + for p in ['PATH', 'OUTPUT_PATH', 'THEME', 'CACHE_PATH', + 'PLUGIN_PATHS']: if settings.get(p) is not None: preserved[p] = settings.get(p) - settings.pop('THEME') # avoid recursion + settings.pop('THEME') # avoid recursion settings = read_settings(theme_config, settings) # restore them back to look like we did not calculate them again - for p in ['PATH', 'OUTPUT_PATH', 'THEME', 'CACHE_PATH', 'PLUGIN_PATHS']: + for p in ['PATH', 'OUTPUT_PATH', 'THEME', 'CACHE_PATH', + 'PLUGIN_PATHS']: if preserved.get(p) is not None: settings[p] = preserved.pop(p) - # make paths selected for writing absolute if necessary settings['WRITE_SELECTED'] = [ os.path.abspath(path) for path in diff --git a/pelican/tests/test_settings.py b/pelican/tests/test_settings.py index 388dd7c1..fa20d9bf 100644 --- a/pelican/tests/test_settings.py +++ b/pelican/tests/test_settings.py @@ -6,12 +6,14 @@ import os from os.path import abspath, dirname, join from sys import platform + from pelican.settings import (DEFAULT_CONFIG, DEFAULT_THEME, _printf_s_to_format_field, configure_settings, handle_deprecated_settings, read_settings) from pelican.tests.support import unittest + class TestSettingsConfiguration(unittest.TestCase): """Provided a file, it should read it, replace the default values, append new values to the settings (if any), and apply basic settings @@ -72,7 +74,7 @@ class TestSettingsConfiguration(unittest.TestCase): expected = copy.deepcopy(self.settings) expected['THEME'] = os.path.join(self.PATH, 'themes/custom') expected['CUSTOM_THEME_SETTING'] = 'test' - settings = read_settings(default_conf, { 'THEME': 'themes/custom' } ) + settings = read_settings(default_conf, {'THEME': 'themes/custom'}) self.maxDiff = None self.assertDictEqual(settings, expected)