aboutsummaryrefslogtreecommitdiff
path: root/src/mailman_pgp/styles/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman_pgp/styles/base.py')
-rw-r--r--src/mailman_pgp/styles/base.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/mailman_pgp/styles/base.py b/src/mailman_pgp/styles/base.py
index 90df92b..b6e4c49 100644
--- a/src/mailman_pgp/styles/base.py
+++ b/src/mailman_pgp/styles/base.py
@@ -16,6 +16,8 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
""""""
+import logging
+
from public import public
from mailman_pgp.config import config, mm_config
@@ -23,6 +25,8 @@ from mailman_pgp.database import transaction
from mailman_pgp.model.list import PGPMailingList
from mailman_pgp.pgp.keygen import ListKeyGenerator
+log = logging.getLogger('mailman.plugin.pgp.styles')
+
@public
class PGPStyle:
@@ -30,6 +34,12 @@ class PGPStyle:
"""Creates the encrypted mailing list instance for the list it's
applied to.
"""
+ pgp_list = PGPMailingList.for_list(mailing_list)
+ if pgp_list:
+ return
+
+ generate = config.get_value('keypairs', 'autogenerate')
+
mailing_list.posting_chain = 'pgp-posting-chain'
old_policy = mailing_list.subscription_policy.name
@@ -37,13 +47,9 @@ class PGPStyle:
if new_policy_name in mm_config.workflows:
mailing_list.subscription_policy = new_policy_name
- pgp_list = PGPMailingList.for_list(mailing_list)
- if pgp_list:
- return
-
- generate = config.get_value('keypairs', 'autogenerate')
-
with transaction() as session:
+ log.debug(
+ 'Creating a PGP mailing list {}.'.format(mailing_list.list_id))
pgp_list = PGPMailingList(mailing_list)
if generate:
keygen = ListKeyGenerator(pgp_list)