summaryrefslogtreecommitdiff
path: root/alot/settings
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-11-20 14:59:34 +0100
committerAnton Khirnov <anton@khirnov.net>2021-11-20 14:59:34 +0100
commit2b6c9088c78d1aa944eeb969f678d644b8ef1180 (patch)
tree294a983822471a2d65581fdf945b457fc724cb3f /alot/settings
parentd64e41150f6ba53a9361e8560d374bc69974ca84 (diff)
commands/envelope: refactor deriving headers to be edited
Split the code into its own function. Make it properly case-insensitive. Apply either the blacklist or the whitelist setting, trying to apply both makes no sense. Enforce that either a blacklist or a whitelist is configured in the settings.
Diffstat (limited to 'alot/settings')
-rw-r--r--alot/settings/manager.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/alot/settings/manager.py b/alot/settings/manager.py
index f8ade6df..e4fa48d7 100644
--- a/alot/settings/manager.py
+++ b/alot/settings/manager.py
@@ -154,6 +154,16 @@ class SettingsManager:
tempdir = self._config.get('template_dir')
logging.debug('template directory: `%s`' % tempdir)
+ # validate edit_headers_whitelist/blacklist, which depend on each other
+ wl = self._config.get('edit_headers_whitelist')
+ bl = self._config.get('edit_headers_blacklist')
+ if (wl == ['*']) == (bl == ['*']):
+ raise ConfigError('Exactly one of "edit_headers_whitelist"',
+ '"edit_headers_blacklist" must be "*"')
+ if ('*' in wl and len(wl) > 1) or ('*' in bl and len(bl) > 1):
+ raise ConfigError('When "*" is used in "edit_headers_whitelist"/'
+ '"edit_headers_blacklist", it must be the only item.')
+
# themes
themestring = newconfig['theme']
themes_dir = self._config.get('themes_dir')