summaryrefslogtreecommitdiff
path: root/mailman/app
diff options
context:
space:
mode:
authorBarry Warsaw2008-03-23 17:38:41 -0400
committerBarry Warsaw2008-03-23 17:38:41 -0400
commit16d7c64da2a3f674e2dcd2e0c5d38d2abf63cd83 (patch)
tree62ca492dd14aa690e6f5df84789e977402a028a3 /mailman/app
parent1152d9a475f29c49bf342782b2037bb2a28def9b (diff)
downloadmailman-16d7c64da2a3f674e2dcd2e0c5d38d2abf63cd83.tar.gz
mailman-16d7c64da2a3f674e2dcd2e0c5d38d2abf63cd83.tar.zst
mailman-16d7c64da2a3f674e2dcd2e0c5d38d2abf63cd83.zip
Move AlreadySubscribedError to interfaces/member.py in the (new) preference
for putting exceptions close to the interfaces where they are used. MakeRandomPassword() returns unicodes now. Flesh out bin/add_members.py and bin/list_members.py
Diffstat (limited to 'mailman/app')
-rw-r--r--mailman/app/membership.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/mailman/app/membership.py b/mailman/app/membership.py
index aa836ba3d..f3487028f 100644
--- a/mailman/app/membership.py
+++ b/mailman/app/membership.py
@@ -19,6 +19,15 @@
from __future__ import with_statement
+__metaclass__ = type
+__all__ = [
+ 'add_member',
+ 'delete_member',
+ 'send_goodbye_message',
+ 'send_welcome_message',
+ ]
+
+
from email.utils import formataddr
from mailman import Errors
@@ -26,7 +35,7 @@ from mailman import Message
from mailman import Utils
from mailman import i18n
from mailman.configuration import config
-from mailman.interfaces import DeliveryMode, MemberRole
+from mailman.interfaces import AlreadySubscribedError, DeliveryMode, MemberRole
_ = i18n._
@@ -55,7 +64,8 @@ def add_member(mlist, address, realname, password, delivery_mode, language,
# Let's be extra cautious.
Utils.ValidateEmail(address)
if mlist.members.get_member(address) is not None:
- raise Errors.AlreadySubscribedError(address)
+ raise AlreadySubscribedError(mlist.fqdn_listname, address,
+ MemberRole.member)
# Check for banned address here too for admin mass subscribes and
# confirmations.
pattern = Utils.get_pattern(address, mlist.ban_list)