diff options
| author | J08nY | 2017-07-18 00:02:15 +0200 |
|---|---|---|
| committer | J08nY | 2017-07-18 00:04:22 +0200 |
| commit | 33e8fe52ea3dea2afe57af996df3d67dced344f4 (patch) | |
| tree | 5e22fe02ffdf748dc3c33886675ba26e71d01f48 /src/mailman_pgp/model/list.py | |
| parent | b44b55f4cc508c1576870f3ff4b03bf0dab5513e (diff) | |
| download | mailman-pgp-33e8fe52ea3dea2afe57af996df3d67dced344f4.tar.gz mailman-pgp-33e8fe52ea3dea2afe57af996df3d67dced344f4.tar.zst mailman-pgp-33e8fe52ea3dea2afe57af996df3d67dced344f4.zip | |
Diffstat (limited to 'src/mailman_pgp/model/list.py')
| -rw-r--r-- | src/mailman_pgp/model/list.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/mailman_pgp/model/list.py b/src/mailman_pgp/model/list.py index 9bee16d..da542de 100644 --- a/src/mailman_pgp/model/list.py +++ b/src/mailman_pgp/model/list.py @@ -22,14 +22,16 @@ from os.path import exists, isfile, join from flufl.lock import Lock from mailman.database.types import Enum, SAUnicode from mailman.interfaces.action import Action -from mailman.interfaces.listmanager import IListManager +from mailman.interfaces.listmanager import IListManager, ListDeletedEvent from pgpy import PGPKey from public import public from sqlalchemy import Boolean, Column, Integer from sqlalchemy.orm import reconstructor from zope.component import getUtility +from zope.event import classhandler from mailman_pgp.config import config +from mailman_pgp.database import transaction from mailman_pgp.model.base import Base from mailman_pgp.pgp.keygen import ListKeyGenerator @@ -143,3 +145,12 @@ class PGPMailingList(Base): if mlist is None: return None return PGPMailingList.query().filter_by(list_id=mlist.list_id).first() + + +@classhandler.handler(ListDeletedEvent) +def on_delete(mlist): + pgp_list = PGPMailingList.for_list(mlist) + if pgp_list: + with transaction() as session: + # TODO shred the list key + session.delete(pgp_list) |
