diff options
| author | Barry Warsaw | 2016-03-25 11:01:46 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2016-03-25 11:01:46 -0400 |
| commit | 7fd9e5ab09b0da347da0607b47d2d3838bd80f0c (patch) | |
| tree | b150f85e5fc482f45e973a233b5184d3ca4b78a7 /src/mailman/model/bans.py | |
| parent | 71ebe367a52316811f570d09f2213c192a47973f (diff) | |
| download | mailman-7fd9e5ab09b0da347da0607b47d2d3838bd80f0c.tar.gz mailman-7fd9e5ab09b0da347da0607b47d2d3838bd80f0c.tar.zst mailman-7fd9e5ab09b0da347da0607b47d2d3838bd80f0c.zip | |
Diffstat (limited to 'src/mailman/model/bans.py')
| -rw-r--r-- | src/mailman/model/bans.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mailman/model/bans.py b/src/mailman/model/bans.py index e81a7a01a..e690145a4 100644 --- a/src/mailman/model/bans.py +++ b/src/mailman/model/bans.py @@ -19,17 +19,15 @@ import re +from mailman import public from mailman.database.model import Model from mailman.database.transaction import dbconnection from mailman.interfaces.bans import IBan, IBanManager from sqlalchemy import Column, Integer, Unicode from zope.interface import implementer -__all__ = [ - 'BanManager', - ] - +@public @implementer(IBan) class Ban(Model): """See `IBan`.""" @@ -46,6 +44,7 @@ class Ban(Model): self.list_id = list_id +@public @implementer(IBanManager) class BanManager: """See `IBanManager`.""" @@ -84,7 +83,7 @@ class BanManager: bans = store.query(Ban).filter_by(list_id=None) for ban in bans: if (ban.email.startswith('^') and - re.match(ban.email, email, re.IGNORECASE) is not None): + re.match(ban.email, email, re.IGNORECASE) is not None): return True else: # This is a list-specific ban. @@ -99,13 +98,13 @@ class BanManager: bans = store.query(Ban).filter_by(list_id=list_id) for ban in bans: if (ban.email.startswith('^') and - re.match(ban.email, email, re.IGNORECASE) is not None): + re.match(ban.email, email, re.IGNORECASE) is not None): return True # And now try global pattern bans. bans = store.query(Ban).filter_by(list_id=None) for ban in bans: if (ban.email.startswith('^') and - re.match(ban.email, email, re.IGNORECASE) is not None): + re.match(ban.email, email, re.IGNORECASE) is not None): return True return False |
