[Remail] [PATCH 3/3] Make sure list configs inherit global gpg/smime

konstantin at linuxfoundation.org konstantin at linuxfoundation.org
Wed Nov 27 02:27:55 CET 2019


From: Konstantin Ryabitsev <konstantin at linuxfoundation.org>

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 <konstantin at linuxfoundation.org>
---
 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)
-- 
2.23.0




More information about the Remail mailing list