mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Fix #2938
Get rid of the coerce_overrides() function. Add the ParseOverrides argparse.Action to parse overrides. Treat all extra settings values strictly as json values. Test overrides. Edit docs and cli help.
This commit is contained in:
parent
ab81f183c6
commit
5c178a1ccb
5 changed files with 42 additions and 60 deletions
|
|
@ -7,7 +7,7 @@ from sys import platform
|
|||
|
||||
from pelican.settings import (DEFAULT_CONFIG, DEFAULT_THEME,
|
||||
_printf_s_to_format_field,
|
||||
coerce_overrides, configure_settings,
|
||||
configure_settings,
|
||||
handle_deprecated_settings, read_settings)
|
||||
from pelican.tests.support import unittest
|
||||
|
||||
|
|
@ -304,18 +304,3 @@ class TestSettingsConfiguration(unittest.TestCase):
|
|||
[(r'C\+\+', 'cpp')] +
|
||||
self.settings['SLUG_REGEX_SUBSTITUTIONS'])
|
||||
self.assertNotIn('SLUG_SUBSTITUTIONS', settings)
|
||||
|
||||
def test_coerce_overrides(self):
|
||||
overrides = coerce_overrides({
|
||||
'ARTICLE_EXCLUDES': '["testexcl"]',
|
||||
'READERS': '{"foo": "bar"}',
|
||||
'STATIC_EXCLUDE_SOURCES': 'true',
|
||||
'THEME_STATIC_DIR': 'theme',
|
||||
})
|
||||
expected = {
|
||||
'ARTICLE_EXCLUDES': ["testexcl"],
|
||||
'READERS': {"foo": "bar"},
|
||||
'STATIC_EXCLUDE_SOURCES': True,
|
||||
'THEME_STATIC_DIR': 'theme',
|
||||
}
|
||||
self.assertDictEqual(overrides, expected)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue