From 5e8939d9a0c63eae7e8623ba7555b2e4ac379203 Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Tue, 26 Nov 2019 20:27:55 -0500 Subject: [PATCH] remail: Make sure list configs inherit global gpg/smime Per-list config dictionaries were always instantiated with default gpg configuration because global gpg/smime settings were being ignored. This change makes sure that smime and gpg options set on the global level are inherited by list-specific configurations. Signed-off-by: Konstantin Ryabitsev Signed-off-by: Thomas Gleixner --- remail/config.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/remail/config.py b/remail/config.py index d58b88c..99d5217 100644 --- a/remail/config.py +++ b/remail/config.py @@ -263,7 +263,10 @@ list_defaults = { } class list_config(object): - def __init__(self, name, cfgdict): + def __init__(self, name, cfgdict, maincfgdict=None): + if maincfgdict is None: + maincfgdict = {} + base = 'base.lists.%s' %name self.base = base self.name = name @@ -283,8 +286,8 @@ class list_config(object): listid = cfgdict.get('listid', self.listaccount.addr.replace('@', '.')) self.listheaders = build_listheaders(self.listaccount.addr, listid) - self.smime = smime_config(self.listdir, None) - self.gpg = gpg_config(self.listdir, None) + self.smime = smime_config(self.listdir, maincfgdict.get('smime', None)) + self.gpg = gpg_config(self.listdir, maincfgdict.get('gpg', None)) self.admins = accounts_config(get_mandatory('admins', cfgdict, base), base) @@ -334,7 +337,7 @@ class main_config(object): # Configure the lists self.lists = [] for name, l in cfgdict.get('lists', {}).items(): - self.lists.append(list_config(name, l)) + self.lists.append(list_config(name, l, cfgdict)) def show(self): show_attrs(self, main_defaults, 2)