summaryrefslogtreecommitdiff
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.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mailman_pgp/styles/base.py b/src/mailman_pgp/styles/base.py
new file mode 100644
index 0000000..36d11c7
--- /dev/null
+++ b/src/mailman_pgp/styles/base.py
@@ -0,0 +1,23 @@
+""""""
+
+from public import public
+
+from mailman_pgp.config import config
+from mailman_pgp.database import transaction
+from mailman_pgp.model.list import EncryptedMailingList
+
+
+@public
+class EncryptedStyle:
+ def apply(self, mailing_list):
+ """Creates the encrypted mailing list instance for the list it's
+ applied to.
+ """
+ enc_list = config.db.session.query(EncryptedMailingList).filter_by(
+ list_id=mailing_list.list_id).first()
+ if enc_list:
+ return
+
+ enc_list = EncryptedMailingList(mailing_list)
+ with transaction():
+ config.db.session.add(enc_list)