[Mailman-Developers] Python remote urllib.request -> mailman subscription

Kip Warner kip at thevertigo.com
Mon May 27 04:01:40 CEST 2013


Hey list,

I'd just like to preface my post with the acknowledgement that I had
already posted the same query on Mailman-Users last week, but no one
seemed to have an answer at the time. I figured it might be better to
ask the developers.

My Python 3 / PyGI / Gtk+ application, among other things, prompts a
user for their name, email, and password, and then submits an http POST
request to a hard coded remote GNU Mailman server. So far, the code
appears to work and I'll request a peer review by anyone kind enough:

  <http://rod.gs/Cbq>

One potential concern I've found is that it is difficult to machine
parse the server response to reliably distinguish a successful
subscription from a failure. A successful subscription returns an http
code 200, but so do many failed ones (e.g. bad formatted email address
is still code 200). 

The most reliable brute force method I could come up with was to check
the message body of the returned HTML document for the substring "Your
subscription request has been received". Great, except since Mailman is
i18n capable, its gettext could return something semantically
equivalent, but obviously worded different if the locale is changed. 

However, since the server I am submitting the request to will probably
always use the English user interface, this probably won't be an issue,
but is still inelegant and I'd like to solve it. Moreover, even if it
remains in English, but perhaps the string changes anyways when Mailman
is upgraded, then it is a problem again.

Does anyone have any suggestions or other feedback they'd like to share
or propose a better solution?

-- 
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/mailman-developers/attachments/20130526/45f1f759/attachment.pgp>


More information about the Mailman-Developers mailing list