[Mailman-Users] Question About acceptable_aliases

Mark Sapiro msapiro at value.net
Fri Apr 13 07:19:54 CEST 2007


Barry Finkel wrote:

>I have a question about the format of  acceptable_aliases .
>
>I want to know how to specify addresses in a template config file
>that I then use to create new lists.  I have a test list, and in the
>administrator web interface under
>
>     o Privacy options...
>          o [Recipient filters]
>
>in the "Alias names (regexps) ..." box I entered
>
>     aaa at example.com
>     bbb at example.com
>
>(two full addresses on two separate lines).  Note that I am using full
>e-mail addresses and not regular expressions here.  When I used 
>
>     config_list -o ttbsf.config test-transmit
>
>to produce a config file, I saw in ttbsf.config:
>
>     acceptable_aliases = """aaa at example.com
>     bbb at example.com"""
>
>The details page says, "This option takes a list of regular expressions,
>one per line,...".


Correct. so you add addresses and/or regexps in the box, one per line,
and the data are posted to the CGI script which converts them to the
value of the list attribute acceptable_aliases which happens to be a
string which is the list of addresses separated by newlines.


>If I want to add e-mail addresses to an existing
>template file, do I use the format I saw in the config file, with
>three initial quotation marks, each address on a separate line, and
>three closing quotation marks?  This format does not seem user-friendly,
>but I assume that it is the product of the translation of regular
>expressions to config file format.


It is more the translation of the entry in a web page text box into the
actual value of the list attribute.

What is in the input to config_list must be syntactically valid Python
that assigns values to list attributes. In this case, the value is a
single string consisting of the addresses/regexps separated by
newlines.

There are two ways to do this in Python

- as a single-quoted string, all on one line, with newlines represented
as \n as in

acceptable_aliases = "aaa at example.com\nbbb at example.com"

- as a triple-quoted string with literal newlines as in

acceptable_aliases = """aaa at example.com
bbb at example.com"""

(note the actual quote character in either single or triple quoted
strings may be either ' or ".)

I don't know what you might think a "user friendly" format for this
might be, but it probably isn't syntactically correct Python that says
what it needs to.

Note also, that not all list attributes are represented in this way. As
another example, the owner attribute is an actual Python list of
addresses as in

owner = ['owner1 at example,com', 'owner2 at example.com']

so you have to look at an actual config_list output and emulate what
you see there for the form of each attribute you want to change.

-- 
Mark Sapiro <msapiro at value.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