From a8e59ed42798358428fa32b7917ef07b7118766b Mon Sep 17 00:00:00 2001 From: J08nY Date: Fri, 4 Aug 2017 14:56:11 +0200 Subject: Add logging to plugin log, all over. --- src/mailman_pgp/styles/base.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/mailman_pgp/styles/base.py') 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 . """""" +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) -- cgit v1.2.3-70-g09d2