[Mailman-Users] Need Script to Apend to acceptable_aliases

Mark Sapiro mark at msapiro.net
Thu Jan 13 23:54:32 CET 2011


Barry Finkel wrote:

>On 01/12/11 19:08, Mark Sapiro wrote:
>>
>> You could do a few different things in your config_list input. One such
>> would be
>>
>> if mlist.acceptable_aliases:
>>      mlist.acceptable_aliases += '\ntestuser at example.com'
>> else:
>>      mlist.acceptable_aliases = 'testuser at example.com'
>>
>
>
>I revised my script, and I ran some tests.  On a list where I had not
>previously specified an acceptable_aliases string, what was placed in
>that item was
>
>      \ntestuser at example.com


Are you certain the fourth line was as above without the '\n'. That
code says if acceptable_aliases is not the null string, append
'\ntestuser at example.com' to it, otherwise set it equal to
'testuser at example.com' (without a '\n').

So I don't see how the result could be '\ntestuser at example.com' unless
acceptable aliases initially contained white space and the result in
fact was '<whitespace>\ntestuser at example.com'


>Is the leading "\n" going to cause problems?


No. It will just result in an additional alias which is empty or all
white space and such aliases are ignored by the code that checks
acceptable_aliases.


>When I ran it again on the same list using a different e-mail address,
>the resulting item had
>
>      \ntestuser at example.com\nusertwo at example.com


Which is exactly what's expected, i.e. the string
'\nusertwo at example.com' was added to the end of the existing string.

-- 
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