aboutsummaryrefslogtreecommitdiff
path: root/src/mailman_pgp/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman_pgp/model')
-rw-r--r--src/mailman_pgp/model/list.py30
-rw-r--r--src/mailman_pgp/model/sighash.py16
2 files changed, 14 insertions, 32 deletions
diff --git a/src/mailman_pgp/model/list.py b/src/mailman_pgp/model/list.py
index 8b2b5bc..9bee16d 100644
--- a/src/mailman_pgp/model/list.py
+++ b/src/mailman_pgp/model/list.py
@@ -44,36 +44,24 @@ class PGPMailingList(Base):
list_id = Column(SAUnicode, index=True)
# Signature related properties
- unsigned_msg_action = Column(Enum(Action))
- inline_pgp_action = Column(Enum(Action))
- expired_sig_action = Column(Enum(Action))
- revoked_sig_action = Column(Enum(Action))
- # duplicate_sig_action = Column(Enum(Action))
- invalid_sig_action = Column(Enum(Action))
- strip_original_sig = Column(Boolean)
- sign_outgoing = Column(Boolean)
+ unsigned_msg_action = Column(Enum(Action), default=Action.reject)
+ inline_pgp_action = Column(Enum(Action), default=Action.defer)
+ expired_sig_action = Column(Enum(Action), default=Action.reject)
+ revoked_sig_action = Column(Enum(Action), default=Action.reject)
+ invalid_sig_action = Column(Enum(Action), default=Action.reject)
+ duplicate_sig_action = Column(Enum(Action), default=Action.reject)
+ strip_original_sig = Column(Boolean, default=False)
+ sign_outgoing = Column(Boolean, default=False)
# Encryption related properties
- nonencrypted_msg_action = Column(Enum(Action))
+ nonencrypted_msg_action = Column(Enum(Action), default=Action.reject)
def __init__(self, mlist):
super().__init__()
self._init()
- self._defaults()
self.list_id = mlist.list_id
self._mlist = mlist
- def _defaults(self):
- self.unsigned_msg_action = Action.reject
- self.inline_pgp_action = Action.defer
- self.expired_sig_action = Action.reject
- self.revoked_sig_action = Action.reject
- self.invalid_sig_action = Action.reject
- self.strip_original_sig = False
- self.sign_outgoing = False
-
- self.nonencrypted_msg_action = Action.reject
-
@reconstructor
def _init(self):
self._mlist = None
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()