diff options
author | Markus Heiser <markus@darmarit.de> | 2021-04-05 16:33:48 +0200 |
---|---|---|
committer | Markus Heiser <markus@darmarit.de> | 2021-04-05 16:33:48 +0200 |
commit | 9c10b150963babb7f0b52081693a42b2e61eede9 (patch) | |
tree | fec64b234a77a4beb73bacb7f8cde2fdfdc3a200 | |
parent | 7089526723394e7492762b7e5cdd112e1da28990 (diff) | |
download | searxng-9c10b150963babb7f0b52081693a42b2e61eede9.tar.gz searxng-9c10b150963babb7f0b52081693a42b2e61eede9.zip |
[fix] settings_loader.py - use update_dict only for mapping types
I can't set `default_doi_resolver` in `settings.yml` if I'm using
`use_default_settings`. Searx seems to try to interpret all settings at root
level in `settings.yml` as dict, which is correct except for
`default_doi_resolver` which is at root level and a string::
File "/usr/lib/python3.9/site-packages/searx/settings_loader.py", line 125, in load_settings
update_settings(default_settings, user_settings)
File "/usr/lib/python3.9/site-packages/searx/settings_loader.py", line 61, in update_settings
update_dict(default_settings[k], v)
File "/usr/lib/python3.9/site-packages/searx/settings_loader.py", line 48, in update_dict
for k, v in user_dict.items():
AttributeError: 'str' object has no attribute 'items'
Signed-off-by: Markus Heiser <markus@darmarit.de>
Suggested-by: @0xhtml https://github.com/searx/searx/issues/2722#issuecomment-813391659
-rw-r--r-- | searx/settings_loader.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/searx/settings_loader.py b/searx/settings_loader.py index e7126aa89..cfdeb4d91 100644 --- a/searx/settings_loader.py +++ b/searx/settings_loader.py @@ -57,7 +57,7 @@ def update_settings(default_settings, user_settings): # merge everything except the engines for k, v in user_settings.items(): if k not in ('use_default_settings', 'engines'): - if k in default_settings: + if k in default_settings and isinstance(v, Mapping): update_dict(default_settings[k], v) else: default_settings[k] = v |