diff options
-rw-r--r-- | alot/settings/__init__.py | 15 | ||||
-rw-r--r-- | alot/settings/utils.py | 11 |
2 files changed, 12 insertions, 14 deletions
diff --git a/alot/settings/__init__.py b/alot/settings/__init__.py index faae8904..8205d099 100644 --- a/alot/settings/__init__.py +++ b/alot/settings/__init__.py @@ -18,6 +18,7 @@ from alot.helper import pretty_datetime, string_decode from errors import ConfigError from utils import read_config +from utils import resolve_att from checks import force_list from checks import mail_container from checks import gpg_key @@ -274,20 +275,6 @@ class SettingsManager(object): return None return triple[colours.index(colourmode)] - def resolve_att(a, fallback): - """ replace '' and 'default' by fallback values """ - if a is None: - return fallback - try: - if a.background in ['default', '']: - a.background = fallback.background - if a.foreground in ['default', '']: - a.foreground = fallback.foreground - except: - logging.debug('DEFAULT_NORMAL') - logging.debug(a) - return a - # global default attributes for tagstrings. # These could contain values '' and 'default' which we interpret as # "use the values from the widget below" diff --git a/alot/settings/utils.py b/alot/settings/utils.py index 45a70fa0..accc3ab8 100644 --- a/alot/settings/utils.py +++ b/alot/settings/utils.py @@ -42,3 +42,14 @@ def read_config(configpath=None, specpath=None, checks={}): error_msg += msg + '\n' raise ConfigError(error_msg) return config + + +def resolve_att(a, fallback): + """ replace '' and 'default' by fallback values """ + if a is None: + return fallback + if a.background in ['default', '']: + a.background = fallback.background + if a.foreground in ['default', '']: + a.foreground = fallback.foreground + return a |