forked from github/pelican
Replace %s rather than fallback to defaults
3a0add4b6e caused existing configs to fall
back to defaults. But since we know exactly how to fix the user config
so that the behavior doesn't change, we should do so, while still
warning that use of %s is deprecated.
Also fixes a bug where we tried to look for %s in None.
This commit is contained in:
parent
9768c6ead3
commit
b1d44c1c87
2 changed files with 43 additions and 6 deletions
|
|
@ -9,6 +9,7 @@ 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
|
||||
|
|
@ -168,6 +169,14 @@ class TestSettingsConfiguration(unittest.TestCase):
|
|||
|
||||
self.assertRaises(Exception, configure_settings, settings)
|
||||
|
||||
def test__printf_s_to_format_field(self):
|
||||
for s in ('%s', '{%s}', '{%s'):
|
||||
option = 'foo/{}/bar.baz'.format(s)
|
||||
result = _printf_s_to_format_field(option, 'slug')
|
||||
expected = option % 'qux'
|
||||
found = result.format(slug='qux')
|
||||
self.assertEqual(expected, found)
|
||||
|
||||
def test_deprecated_extra_templates_paths(self):
|
||||
settings = self.settings
|
||||
settings['EXTRA_TEMPLATES_PATHS'] = ['/foo/bar', '/ha']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue