[Mailman-Developers] [Fwd: Re: [Mailman-Users] NameError : recipients]

Greg Stein gstein@lyra.org
Wed, 10 Feb 1999 16:00:19 -0800


Greg Stein wrote:
> 
> Scott A. McIntyre wrote:
> >
> > Thanks to Harald, I figured out my WANTED vs GOT and ended up letting
> > mailman run with the GID it GOT and that seems to be much closer to
> > being happy.  However, now, whenever I post, I get the following in the
> > error log:
> >
> > Feb 10 14:48:56 1999 post: Traceback (innermost last):
> > post:   File "/usr/people/mailman/scripts/post", line 65, in ?
> > post:      current_list.Post(msg)
> > post:   File "/usr/people/mailman/Mailman/MailList.py", line 1143, in
> > Post
> > post:      recipients.remove(members)
> > post: NameError :  recipients
> 
> This is a bug in Mailman 1.0b8. It has incorrect code for processing
> "Don't Receive Own Posts". Turn that off, and it should work okay.

I moved a block of lines in MailList.py down below the construction of
the recipients list. It also appeared there was a bug in there that
attempted to remove "members" rather than "sender". The final code looks
like:

        # Try to get the address the list thinks this sender is
        sender = self.FindUser(msg.GetSender())
        if sender:
            if self.GetUserOption(sender, mm_cfg.DontReceiveOwnPosts):
                dont_send_to_sender = 1
            if self.GetUserOption(sender, mm_cfg.AcknowlegePosts):
                ack_post = 1
        # Deliver the mail.
        members = self.GetDeliveryMembers()
        recipients = []
        for m in members:
            if not self.GetUserOption(m, mm_cfg.DisableDelivery):
                recipients.append(m)
        if dont_send_to_sender:
            try:
                recipients.remove(sender)
            #
            # sender not in list (case sensitive username problem?)
            #
            except ValueError:
                self.LogMsg("error",
                            "couldn't remove %s from recipient list:
%s",
                            sender,
                            str(members))
        self.LogMsg("post", "post to %s from %s size=%d",
                    self._internal_name, msg.GetSender(), len(msg.body))

Cheers,
-g

--
Greg Stein, http://www.lyra.org/