[Mailman-Users] sync_members problem

Mark Sapiro mark at msapiro.net
Sat Sep 20 22:15:28 CEST 2008

Brent Kearney wrote:
>There was a comma in one of the email addresses, like this:  
>user at domain,.edu.
>So I solved my data problem, but the question remains as to why  
>add_members didn't fail in the same place.

The processing between add_members and sync_members is different.
sync_members first processes the entire list and if it finds any
invalid addresses, it complains and does nothing. add_members
processes one line at a time, and if there are problems, it reports
them and continues.

In this case, add_members will call email.Utils.parseaddr() to parse
'user at domain,.edu'. parseaddr will return the null string as the real
name and 'user at domain' as the address and ignore the ',.edu' part.

sync_members works differently. It calls email.Utils.getaddresses()
with argument equal to a list of all the lines in the file. This
returns a list of parsed real names and addresses, but because of the
way it processes the list, 'user at domain,.edu' gets treated as two
addresses 'user at domain' and '.edu'.

So both sync_members and add_members see the address 'user at domain'
which at least syntactically looks valid, but additionally,
sync_members sees '.edu' as a separate address which is invalid and
add_members never sees it.

Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

More information about the Mailman-Users mailing list