[Mailman-Developers] Question on pulling list variables

Mark Sapiro mark at msapiro.net
Fri Apr 11 18:58:26 CEST 2008


Justin Long wrote:
>
>While integrating mailman with our website, I am trying to integrate
>in our browse mode. When browsing lists, we generally try to show
>users the following pieces of data:
>
>Mailing List 	Subscriptions 	Postings 	Publicity 	Access
>(listname)     (moderated/open)     (moderated/open)
>(advertised/not)    (person's access to the list)
>
>The only way I can see to pull this data is by using config_list. I've
>actually recoded this (my_config) to drop the comment fields since all
>I need is the variables and the values. But really, I only need very
>specific variables and values.
>
>Has anyone come up with a simple way to either (a) directly access the
>configuration files for a given list from PHP or (b) used withlist
>(I'm not a Python programmer, so I'm hitting my brain against a wall
>right now... for anything advanced) to pull specific variables?
>
>Is there a patch or some little piece of open source code somewhere
>that can help me with this problem?
>
>Config_list seems to work ok but it is taking a lot of compute cycles
>to run it against 20 lists in a row on a browse screen...


You could try using

bin/dumpdb lists/listname/config.pck

instead of config_list. That should be a little quicker; possibly
quicker even than a withlist script.

Although, if you were to use bin/withlist -a rather than invoking
bin/dumpdb separately for each list, that might be better.

Consider get_data.py as follows:

def get_data(mlist, user):
    print "Mailing List: %s" % mlist.real_name
    print "Subscribe Policy: %d" % mlist.subscribe_policy
    print "Default Moderation: %s" % mlist.default_member_moderation
    print "Advertised: %s" % mlist.advertised
    print "%s is member: %s" % (user, mlist.isMember(user))

and run by

bin/withlist -a -r get_data -- user at example.com

That's probably not really what you want as I had to guess what you
meant by "Postings" and "Access" and my guesses gave some things that
aren't available from config_list.

-- 
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-Developers mailing list