[Mailman-Developers] Mailman 3 and New Lists (Templates for Defining?)

Barry Warsaw barry at list.org
Tue Mar 5 21:23:39 CET 2013


On Mar 02, 2013, at 10:38 AM, Tom Browder wrote:

>Earlier I was pointed to the REST API for programatically generating a new
>list--looks good.  However, the docs mention a default set of attributes for
>a new list and I wonder if there are yet any other choices.
>
>I guess the real question for me is: is there a templating system in MM 3 so
>that different list types can be defined?  My search through the code so far
>hasn't found such except for language templates.

Yes, these are called "list styles".  See the IStyle interface in
src/mailman/interfaces/styles.py for the API and src/mailman/styles/default.py
for the two built-in styles, both essentially legacy styles.

Note that styles are only applied when a list is created, so it is better to
think of them as the default set of attributes for a list.  IOW, if you
changed a style after a list is created, the list attributes do not change.
In fact, the mailing list doesn't record what styles were applied to it.

The mailman.cfg file has a [styles] section, with a `paths` variable and a
`default` variable.  The `paths` variable names Python dotted-module paths
which are searched for IStyle implementations.  Thus, if you arranged for your
MM3 installation to include on sys.path, the package mylocal.mailman.styles,
you could put your own styles in there and Mailman should find them
automatically.

At that point, you can use one of your named styles as the default (via the
`[styles]default` variable), or you can specify the style to use when creating
a new list through the REST API.  See src/mailman/rest/docs/list.rst for
details.

>Having just agonizingly set up a true (IMHO) read-only list under Mailman 2,
>I think such a template to choose (at least to start from) would be very
>helpful in Mailman 3.  (I don't doubt there is an easier way under Mailman 2,
>but I find the various inputs in the web interface too scattered around for
>my tastes.)

Hopefully the above makes sense, and provides enough information to play with
the feature in MM3.  I'm absolutely open to ideas for making list styles
easier to add, customize, and use.

Cheers,
-Barry


More information about the Mailman-Developers mailing list