[Mailman-Developers] Silly mailman question

Barry A. Warsaw barry@zope.com
Fri, 5 Apr 2002 12:24:38 -0500


>>>>> "JRA" == Jay R Ashworth <jra@baylink.com> writes:

    JRA> The problem is that they're already in a database (filePro
    JRA> for Unix on SCO 5, on a machine behind a Linux 7.1 firewall),
    JRA> and they want to be able to selectwhom to mail on an adhoc
    JRA> basis.

    JRA> This seems to suggest to *me* that I need to be able to
    JRA> either 1) set up and strike lists on the mailman side with
    JRA> some dispatch, or better 2) wire mailman atop the extant
    JRA> database... which I would prefer to do because I *don't* want
    JRA> to lose the web-based signoff stuff, etc.

Can you use MM2.1?  If so, then your options are many.

If the membership list needs to change on the fly, then use the new
"virtual list" feature.  I.e. create a list that all the message will
appear to come from but build the recipient list on-the-fly.  The
easiest way to do this is, use a Python program to suck the data out
of filePro (I've no idea how to do that), and build a Python list of
recipients addresses.  Then, make sure the installed Mailman package
is in your sys.path (so your driver script can import Mailman
modules).

Assuming you've got the listname, the list of recipients, and the
message as plain text, it might be as simple as:

    from Mailman.Post import inject
    inject(listname, msgtext, recipients)

Note that Mailman/Post.py can also be run as a command line script.

Alternatively, you might want to use the new extend.py interface to
hook into the MailList instance for your list.  If there's a file
called extend.py in your lists/listname directory, it will be
execfile()'d and a function extend() will be called, passing in the
MailList instance.

Your extend() function can do something like, overload the Load() and
Save() method so that membership data is funneled to your database.
You probably just need to re-implement the MemberAdaptor.py interface
and set the mlist._memberadaptor attribute to your customized
version.  Then everything else should Just Work.

If you're stuck on MM2.0.x, then you've got your work cut out for you
<wink>.

    JRA> This is, of course, a paying gig... and it's not impossible I
    JRA> might sub out the "interface the back of Mailman to my
    JRA> database" part, particularly if it can be done generally
    JRA> enough to make accessing filePro data from Python easy, since
    JRA> that's something I'd find generically useful.

It would be nice if this was spec'd as being releasable under the
Python license, so it could be donated back to Python.

HTH,
-Barry