diff options
| author | J08nY | 2017-07-17 21:21:38 +0200 |
|---|---|---|
| committer | J08nY | 2017-07-17 21:21:38 +0200 |
| commit | 2703337c99eb62cb1ae8b516789f41732a4171d7 (patch) | |
| tree | eb42c6ab55466352db20f35e7e44a73510147d21 /src/mailman_pgp/model/sighash.py | |
| parent | 20317c3444e0b11d8d4676dec23c34222d4d7340 (diff) | |
| download | mailman-pgp-2703337c99eb62cb1ae8b516789f41732a4171d7.tar.gz mailman-pgp-2703337c99eb62cb1ae8b516789f41732a4171d7.tar.zst mailman-pgp-2703337c99eb62cb1ae8b516789f41732a4171d7.zip | |
Implement basic duplicate signature hash rule.
Diffstat (limited to 'src/mailman_pgp/model/sighash.py')
| -rw-r--r-- | src/mailman_pgp/model/sighash.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/mailman_pgp/model/sighash.py b/src/mailman_pgp/model/sighash.py index 2dddc02..6511484 100644 --- a/src/mailman_pgp/model/sighash.py +++ b/src/mailman_pgp/model/sighash.py @@ -16,7 +16,7 @@ # this program. If not, see <http://www.gnu.org/licenses/>. """""" -from sqlalchemy import Column, DateTime, LargeBinary, String +from sqlalchemy import Column, LargeBinary, String from mailman_pgp.model.base import Base @@ -24,19 +24,13 @@ from mailman_pgp.model.base import Base class PGPSigHash(Base): """""" - __tablename__ = "sighash" + __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: + def hashes(hashes): + if hashes is None or len(hashes) == 0: return None - return PGPSigHash.query().filter_by(**kws).all() + return PGPSigHash.query().filter(PGPSigHash.hash.in_(hashes)).all() |
