summaryrefslogtreecommitdiff
path: root/mailman/commands
diff options
context:
space:
mode:
Diffstat (limited to 'mailman/commands')
-rw-r--r--mailman/commands/docs/join.txt41
-rw-r--r--mailman/commands/join.py66
2 files changed, 41 insertions, 66 deletions
diff --git a/mailman/commands/docs/join.txt b/mailman/commands/docs/join.txt
index 4cc805e99..492297787 100644
--- a/mailman/commands/docs/join.txt
+++ b/mailman/commands/docs/join.txt
@@ -29,7 +29,7 @@ No address to join
>>> from mailman.Message import Message
>>> from mailman.app.lifecycle import create_list
>>> from mailman.queue.command import Results
- >>> mlist = create_list(u'test@example.com')
+ >>> mlist = create_list(u'alpha@example.com')
When no address argument is given, the message's From address will be used.
If that's missing though, then an error is returned.
@@ -131,3 +131,42 @@ list.
Anne Person
>>> list(user.addresses)
[<Address: Anne Person <anne@example.com> [verified] at ...>]
+
+Anne is also now a member of the mailing list.
+
+ >>> mlist.members.get_member(u'anne@example.com')
+ <Member: Anne Person <anne@example.com>
+ on alpha@example.com as MemberRole.member>
+
+
+Joining a second list
+---------------------
+
+ >>> mlist_2 = create_list(u'baker@example.com')
+ >>> msg = message_from_string("""\
+ ... From: Anne Person <anne@example.com>
+ ...
+ ... """)
+ >>> print command.process(mlist_2, msg, {}, (), Results())
+ ContinueProcessing.yes
+
+Anne of course, is still registered.
+
+ >>> print config.db.user_manager.get_user(u'anne@example.com')
+ <User "Anne Person" at ...>
+
+But she is not a member of the mailing list.
+
+ >>> print mlist_2.members.get_member(u'anne@example.com')
+ None
+
+One Anne confirms this subscription, she becomes a member of the mailing list.
+
+ >>> qmsg, qdata = virginq.dequeue(virginq.files[0])
+ >>> token = str(qmsg['subject']).split()[1].strip()
+ >>> registrar.confirm(token)
+ True
+
+ >>> print mlist_2.members.get_member(u'anne@example.com')
+ <Member: Anne Person <anne@example.com>
+ on baker@example.com as MemberRole.member>
diff --git a/mailman/commands/join.py b/mailman/commands/join.py
index 45535470f..639a74a99 100644
--- a/mailman/commands/join.py
+++ b/mailman/commands/join.py
@@ -69,7 +69,7 @@ example:
return ContinueProcessing.no
domain = config.domains[mlist.host_name]
registrar = IRegistrar(domain)
- registrar.register(address, real_name)
+ registrar.register(address, real_name, mlist)
person = formataddr((real_name, address))
print >> results, _('Confirmation email sent to $person')
return ContinueProcessing.yes
@@ -120,70 +120,6 @@ example:
return address, delivery_mode
-def ignore():
- # Fill in empty defaults
- if digest is None:
- digest = mlist.digest_is_default
- if password is None:
- password = Utils.MakeRandomPassword()
- if address is None:
- realname, address = parseaddr(res.msg['from'])
- if not address:
- # Fall back to the sender address
- address = res.msg.get_sender()
- if not address:
- res.results.append(_('No valid address found to subscribe'))
- return STOP
- # Watch for encoded names
- try:
- h = make_header(decode_header(realname))
- # BAW: in Python 2.2, use just unicode(h)
- realname = h.__unicode__()
- except UnicodeError:
- realname = u''
- # Coerce to byte string if uh contains only ascii
- try:
- realname = realname.encode('us-ascii')
- except UnicodeError:
- pass
- # Create the UserDesc record and do a non-approved subscription
- listowner = mlist.GetOwnerEmail()
- userdesc = UserDesc(address, realname, password, digest)
- remote = res.msg.get_sender()
- try:
- mlist.AddMember(userdesc, remote)
- except Errors.MembershipIsBanned:
- res.results.append(_("""\
-The email address you supplied is banned from this mailing list.
-If you think this restriction is erroneous, please contact the list
-owners at %(listowner)s."""))
- return STOP
- except Errors.InvalidEmailAddress:
- res.results.append(_("""\
-Mailman won't accept the given email address as a valid address."""))
- return STOP
- except Errors.MMAlreadyAMember:
- res.results.append(_('You are already subscribed!'))
- return STOP
- except Errors.MMCantDigestError:
- res.results.append(
- _('No one can subscribe to the digest of this list!'))
- return STOP
- except Errors.MMMustDigestError:
- res.results.append(_('This list only supports digest subscriptions!'))
- return STOP
- except Errors.MMSubscribeNeedsConfirmation:
- # We don't need to respond /and/ send a confirmation message.
- res.respond = 0
- except Errors.MMNeedApproval:
- res.results.append(_("""\
-Your subscription request has been forwarded to the list administrator
-at %(listowner)s for review."""))
- else:
- # Everything is a-ok
- res.results.append(_('Subscription request succeeded.'))
-
-
class Subscribe(Join):
"""The email 'subscribe' command (an alias for 'join')."""