mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Fix #2938
This commit is contained in:
parent
620ad3cfa3
commit
ea0e3e8338
2 changed files with 10 additions and 2 deletions
3
RELEASE.md
Normal file
3
RELEASE.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Release type: patch
|
||||
|
||||
Fix incorrect parsing of boolean parameters specified via `-e` / `--extra-settings` option flags (#2938).
|
||||
|
|
@ -662,16 +662,21 @@ def configure_settings(settings):
|
|||
|
||||
|
||||
def coerce_overrides(overrides):
|
||||
"""Converts string values in the `overrides` dictionary
|
||||
to correspoding Python types.
|
||||
"""
|
||||
if overrides is None:
|
||||
return {}
|
||||
coerced = {}
|
||||
types_to_cast = {int, str, bool}
|
||||
types_to_cast = {int, str}
|
||||
for k, v in overrides.items():
|
||||
if k not in DEFAULT_CONFIG:
|
||||
logger.warning('Override for unknown setting %s, ignoring', k)
|
||||
continue
|
||||
setting_type = type(DEFAULT_CONFIG[k])
|
||||
if setting_type not in types_to_cast:
|
||||
if setting_type is bool:
|
||||
coerced[k] = v not in {'', '0', 'false', 'False'}
|
||||
elif setting_type not in types_to_cast:
|
||||
coerced[k] = json.loads(v)
|
||||
else:
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue