diff options
| author | J08nY | 2017-07-17 17:44:59 +0200 |
|---|---|---|
| committer | J08nY | 2017-07-17 17:44:59 +0200 |
| commit | 603c4b1acdbbb512056a0caaa76ee56b118bcd49 (patch) | |
| tree | b2aea3aad6e77191292701d10cb0abbe7522dcb8 /src/mailman_pgp/model | |
| parent | bc396ca1623c885cd6df4ab49bcccf23880a29c8 (diff) | |
| download | mailman-pgp-603c4b1acdbbb512056a0caaa76ee56b118bcd49.tar.gz mailman-pgp-603c4b1acdbbb512056a0caaa76ee56b118bcd49.tar.zst mailman-pgp-603c4b1acdbbb512056a0caaa76ee56b118bcd49.zip | |
Diffstat (limited to 'src/mailman_pgp/model')
| -rw-r--r-- | src/mailman_pgp/model/address.py | 4 | ||||
| -rw-r--r-- | src/mailman_pgp/model/sighash.py | 42 |
2 files changed, 44 insertions, 2 deletions
diff --git a/src/mailman_pgp/model/address.py b/src/mailman_pgp/model/address.py index 25a87dc..9444f5a 100644 --- a/src/mailman_pgp/model/address.py +++ b/src/mailman_pgp/model/address.py @@ -22,7 +22,7 @@ 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 Boolean, Column, Integer +from sqlalchemy import Boolean, Column, Integer, String from sqlalchemy.orm import reconstructor from zope.component import getUtility @@ -37,7 +37,7 @@ class PGPAddress(Base): id = Column(Integer, primary_key=True) email = Column(SAUnicode, index=True, unique=True) - key_fingerprint = Column(SAUnicode) + key_fingerprint = Column(String(50)) key_confirmed = Column(Boolean, default=False) def __init__(self, address): diff --git a/src/mailman_pgp/model/sighash.py b/src/mailman_pgp/model/sighash.py new file mode 100644 index 0000000..0c61e38 --- /dev/null +++ b/src/mailman_pgp/model/sighash.py @@ -0,0 +1,42 @@ +# Copyright (C) 2017 Jan Jancar +# +# This file is a part of the Mailman PGP plugin. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program. If not, see <http://www.gnu.org/licenses/>. + +"""""" +from sqlalchemy import LargeBinary, Column, String, DateTime + +from mailman_pgp.model.base import Base + + +class PGPSigHash(Base): + """""" + + __tablename__ = "sighash" + + hash = Column(LargeBinary, primary_key=True) + fingerprint = Column(String(50), index=True) + time = Column(DateTime) + + @staticmethod + def find(hash=None, fingerprint=None): + kws = {} + if hash is not None: + kws['hash'] = hash + if fingerprint is not None: + kws['fingerprint'] = fingerprint + if len(kws) == 0: + return None + return PGPSigHash.query().filter_by(**kws).all() |
