diff options
| author | J08nY | 2017-06-22 19:23:45 +0200 |
|---|---|---|
| committer | J08nY | 2017-06-22 19:23:45 +0200 |
| commit | 90529b7058362d2a43625f95bcd3afc8b9733203 (patch) | |
| tree | 6c3e10bb7773e794ca0a44538242e88e220e5288 /src | |
| parent | e74efa507117bd449695bfc9dc1fb3ed473fd3eb (diff) | |
| download | mailman-pgp-90529b7058362d2a43625f95bcd3afc8b9733203.tar.gz mailman-pgp-90529b7058362d2a43625f95bcd3afc8b9733203.tar.zst mailman-pgp-90529b7058362d2a43625f95bcd3afc8b9733203.zip | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman_pgp/model/address.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mailman_pgp/model/address.py b/src/mailman_pgp/model/address.py index 1dc3840..6abe0c1 100644 --- a/src/mailman_pgp/model/address.py +++ b/src/mailman_pgp/model/address.py @@ -20,9 +20,11 @@ from os.path import exists, isfile, join from mailman.database.types import SAUnicode +from mailman.interfaces.usermanager import IUserManager from pgpy import PGPKey from sqlalchemy import Column, Integer from sqlalchemy.orm import reconstructor +from zope.component import getUtility from mailman_pgp.config import config from mailman_pgp.model.base import Base @@ -37,13 +39,15 @@ class PGPAddress(Base): email = Column(SAUnicode, index=True) key_fingerprint = Column(SAUnicode) - def __init__(self, email): + def __init__(self, address): super().__init__() - self.email = email + self.email = address.email self._init() + self._address = address @reconstructor def _init(self): + self._address = None self._key = None @property @@ -61,3 +65,9 @@ class PGPAddress(Base): return None return join(config.pgp.keydir_config['user_keydir'], self.key_fingerprint + '.asc') + + @property + def address(self): + if self._address is None: + self._address = getUtility(IUserManager).get_address(self.email) + return self._address |
