Re: [Mailman-Developers] Interacting with mailman remotely through APIs / wrappers
Many thanks for your speedy response,
Apologies for any ignorance displayed regarding Mailman - I have begun experimenting with it only recently as a way to add mailing list functionality to the existing PHP application I mentioned. (As a side note, a big thank you to whoever builds the Debian package - completely painless, especially compared with Sympa...)
With regards to Mailman 3, from my reading I understand that this will implement SQL-type storage for all configuration and list data. This would completely take care of my needs in this case I think; would you perhaps be able to give us a rough idea of progress?
As a garden-variety PHP developer and Mailman rookie, I doubt how far I am capable of going deep into Mailman itself to implement a solution for this. I would be happy to do the research before dismissing the idea though, if you could point me in the direction of some bedtime reading on the subject. Given the time I have available and the limited functionality required, I'm very much leaning towards the cheapest hack option - which seems likely to be simply executing command line commands.
Regarding your questions:
-- What functionality do you want to expose?
Not much. To start with, creating and removing lists and adding and deleting subscribers would probably be enough.
-- How would you handle security?
To be honest, I hadn't even got as far as thinking about that, since I'm not really clear on the mechanisms involved.
- Will you have to re-implement much of the CGI logic?
Again, I haven't gone through closely enough to give a decent answer. If I was hacking something up which did use the Web Interface as a gateway, I would be more likely to use Mechanize to fake a browser and do the intereacting. Ugly I know, but I'm familiar with that so I could get it to work.
Sorry that I don't have the experience to come up with better ideas on this; as I said, I welcome input from anybody that has already attempted this kind of work.
Regards, Benjamin
----- Original Message ---- From: Barry Warsaw <barry@python.org> To: Ben Sims <benjaminsims@yahoo.com> Cc: mailman-developers@python.org Sent: Wednesday, 16 May, 2007 4:05:53 PM Subject: Re: [Mailman-Developers] Interacting with mailman remotely through APIs / wrappers
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On May 16, 2007, at 5:00 AM, Ben Sims wrote:
All of these are rather clunky. My dream response would be some sort of
Web service / API interface with a corresponding PHP client object, but I haven't been able to find any evidence of this existing.
I think this could be handled fairly easily, and it would make an
excellent project for Mailman 3. You could prototype the work for
Mailman 2.1 fairly easily too.
The way I'd go about thinking about this would be to implement a
qrunner based on Python's standard SimpleXMLRPCServer module. While
not technically a 'queue runner', we already have some precedence in
the trunk for running other types of long-running processes from the
qrunner architecture, so while a slight misnomer, it's quite workable.
The questions of course are
- What functionality do you want to expose?
- How will you handle security?
- Will you have to re-implement much of the CGI logic?
I think you could pretty easily throw together the architecture for
this and then start to answer the other questions. In Mailman 3 I'm
trying hard to get functionality that lives only in the CGI or
command line scripts accessible through the standard Mailman package.
One other thing to think about: In the trunk, we already have a wsgi-
based web server which should allow sites to swap in their own HTTP-
based access to Mailman if they wanted (e.g. via Zope, Django,
TurboGears, etc.). Many of these web publishing frameworks also have
XMLRPC publishing. I don't know what the standards there are, but
IWBNI we could swap those publishing mechanisms as well.
- -Barry
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin)
iQCVAwUBRksBsnEjvBPtnXfVAQKOqgP9HzgbldPeM8QNEsbN98PbksHVzP/qBOEN isXu3dDHGvtTx8DxJbgtQ2R0qSPJU7nsKvIC8O1Iqw01t+89MZLVEbCAx+uiPj1K wPXsYoitDW4XeN7CCfBE+xoEFL++mRqH6K3MC3zOavqt6HZ07hbQBKLE/XmMEepR BAcTbwnUEjI= =nwzh -----END PGP SIGNATURE-----
___________________________________________________________
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.htm...
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On May 17, 2007, at 8:39 AM, Ben Sims wrote:
With regards to Mailman 3, from my reading I understand that this
will implement SQL-type storage for all configuration and list
data. This would completely take care of my needs in this case I
think; would you perhaps be able to give us a rough idea of progress?
Things are moving along well. My work these days has been to
complete the data model using Elixir and SQLAlchemy. I had a
breakthrough with Elixir a few days ago, so now I'm just working on
completing the model, related interfaces, and doctests. My plan is
to have a working database backend asap so I can unbreak all the
higher level stuff that depends on the data model. Right now I'm
working in a branch, but I am going to very soon merge this back to
the trunk, even though it will break the trunk. I speak more about
this in some later postings.
I'm trying to be very diligent about writing interfaces to describe
how Mailman interacts with the data model, so you could potentially
back it with different storage mechanisms. The idea is that you
might want to put your list data in Mailman's default SQLite
database, but you might want to get your user data out of your
enterprise database. By writing your own implementations of
Mailman's interfaces, you should be able to do that.
As a garden-variety PHP developer and Mailman rookie, I doubt how
far I am capable of going deep into Mailman itself to implement a
solution for this. I would be happy to do the research before
dismissing the idea though, if you could point me in the direction
of some bedtime reading on the subject. Given the time I have
available and the limited functionality required, I'm very much
leaning towards the cheapest hack option - which seems likely to be
simply executing command line commands.
I wonder if there isn't a cleaner way to integrate PHP and Python.
Does anybody know? Or is some form of IPC really the only way to go?
Writing command line interfaces to provide the functionality you want
should not be difficult at all, if you are comfortable writing Python.
Regarding your questions:
-- What functionality do you want to expose?
Not much. To start with, creating and removing lists and adding and
deleting subscribers would probably be enough.
Creating and removing lists are a bit hackish now because the logic
to do so is spread out in a couple of places. However see the bin/
newlist script or Mailman/Cgi/newlist.py module for examples. The
former may already do what you need here. This will get much easier
in MM3.
Likewise for adding and deleting subscribers.
-- How would you handle security?
To be honest, I hadn't even got as far as thinking about that,
since I'm not really clear on the mechanisms involved.
- Will you have to re-implement much of the CGI logic?
Again, I haven't gone through closely enough to give a decent
answer. If I was hacking something up which did use the Web
Interface as a gateway, I would be more likely to use Mechanize to
fake a browser and do the intereacting. Ugly I know, but I'm
familiar with that so I could get it to work.
Probably much easier to use the existing command line scripts,
augmenting or writing your own as needed. Remember you can also do a
lot with bin/withlist scripts.
Cheers,
- -Barry
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin)
iQCVAwUBRk4hh3EjvBPtnXfVAQIQ+AP9HupG3WJ9X8hD+vsowrLCq5FwWlw194P9 iB2qHhTbafFlURf/7dXt+JLfX7UjTchydsBPaNR00UwBUZcMohTXCbJJSEi+kMwg 7p32bknigvmC/3qujLzkZz08lwUo86mK6e7q/w55O6fb1DAXVfYiw+1LpBJagZ7h E/iTlLiJHOI= =yIkR -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Barry Warsaw wrote:
[...] I wonder if there isn't a cleaner way to integrate PHP and Python.
Does anybody know? Or is some form of IPC really the only way to go?Writing command line interfaces to provide the functionality you want
should not be difficult at all, if you are comfortable writing Python.
I've built applications that manipulate Mailman data using both the internal Python APIs and the command-line scripts, and I can say that both have their pleasantries and annoyances in about equal share.
Generally, the command-line tools are "good enough," and are certainly easier to expose to anything not written in Python. However, the argument handling is just different enough between tools to make a totally general bridge difficult to write without special cases for each action (add/list/remove member, add/show/delete list, etc.).
We have Perl and Ruby apps using the CLI tools to manipulate list membership, though most run either under cron or an interactive SSH session to the Mailman server.
The Python APIs can be faster, and certainly give you more powerful (read: unrestricted) access to list data. For operations over large numbers of lists, though, the unmarshalling of list pickles seems to be the limiting factor, not the Python startup overhead.
One such all-Python application I've developed for use here at Reed uses web.py and the Mailman Python APIs to expose a quick 'opt-in' interface to a subset of our campus mailing lists. We rely on our LDAP directory and web single-sign-on infrastructure to simplify the subscription process: basically, after completing SSO auth, users can simply check the subscription box next to each list name, and be automatically added to (or removed from) it.
I'm eagerly looking forward to MM3 (or at least the SQLAlchemy branch) making much of the hackish local customization work I've done unnecessary. The XML-RPC interface sounds interesting, too, though I don't know that it will really offer enough to prompt a rewrite of all our command-line driven add-ons.
Lennon Day-Reynolds Systems Programmer Reed College -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGUghIRtirLnfvQskRAoaMAKCpAwxGPFJzXyEMgTJDLyLo7Hs+uwCdHP/l HMJgJcyut94SzbgOC9IAcRo= =77oH -----END PGP SIGNATURE-----
participants (3)
-
Barry Warsaw
-
Ben Sims
-
Lennon Day-Reynolds