diff options
| author | J08nY | 2017-06-22 19:12:04 +0200 |
|---|---|---|
| committer | J08nY | 2017-06-22 19:12:04 +0200 |
| commit | 5014e7a75f02f8c707847122ff43b37064247a43 (patch) | |
| tree | 19bda52a1507fa7fe09e051ccee0129aace62d85 /src/mailman_pgp/model/list.py | |
| parent | 429234b8db28ed6aadf21a3ccfce7eaf7065be71 (diff) | |
| download | mailman-pgp-5014e7a75f02f8c707847122ff43b37064247a43.tar.gz mailman-pgp-5014e7a75f02f8c707847122ff43b37064247a43.tar.zst mailman-pgp-5014e7a75f02f8c707847122ff43b37064247a43.zip | |
Diffstat (limited to 'src/mailman_pgp/model/list.py')
| -rw-r--r-- | src/mailman_pgp/model/list.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mailman_pgp/model/list.py b/src/mailman_pgp/model/list.py index 84dd1a8..e1de7cc 100644 --- a/src/mailman_pgp/model/list.py +++ b/src/mailman_pgp/model/list.py @@ -15,18 +15,18 @@ # You should have received a copy of the GNU General Public License along with # this program. If not, see <http://www.gnu.org/licenses/>. -"""""" +"""Model for PGP enabled mailing lists.""" from os.path import exists, isfile, join -from mailman.config import config as mailman_config from mailman.database.types import Enum, SAUnicode from mailman.interfaces.action import Action -from mailman.model.mailinglist import MailingList +from mailman.interfaces.listmanager import IListManager 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 mailman_pgp.config import config from mailman_pgp.model.base import Base @@ -35,6 +35,8 @@ from mailman_pgp.pgp.keygen import ListKeyGenerator @public class PGPMailingList(Base): + """A PGP enabled mailing list.""" + __tablename__ = 'pgp_lists' id = Column(Integer, primary_key=True) @@ -76,10 +78,9 @@ class PGPMailingList(Base): @property def mlist(self): - if self._mlist is not None: - return self._mlist - return mailman_config.db.store.query(MailingList).filter_by( - _list_id=self.list_id).first() + if self._mlist is None: + self._mlist = getUtility(IListManager).get_by_list_id(self.list_id) + return self._mlist @property def key(self): |
