On 8/8/2009 7:10, Trent W. Buck wrote:
Darcs send to HTTP POST seems to me to be the most useful for
"relatively untrusted users to push changes".

Is there a production-ready implementation of the glue receive darcs
send's HTTP POST and feed it into a darcs apply?

I've got most of the parsing logic needed for Python (as a Django view, which shouldn't be terribly far from any other Python web framework's request object structure) (and which I did test against darcs send's output). It still needs "robustification" work, which I haven't done yet, but is on my "near term" todo list. What I need to add is simple sanity checking to make sure it is grabbing the right payload (by double-checking the MIME content type and/or name, probably).

Actually, since my "test script" is short enough, why I don't I just paste it here for anyone interested (its just about the same code if you were to iterate over an IMAP mailbox of messages, using Python's imaplib, in RFC822 format, as well):

from django.http import Http404, HttpResponse
from email.parser import Parser

def test_darcs_send(request):
        p = Parser()
        email = p.parsestr(request.raw_post_data)
        print email.keys()
        print email['From']
        print email['Subject']
        print email['DarcsURL'] # repository darcs send believes it is sending 
to
        print email.is_multipart() # darcs send sends multipart emails
        # the payload of a message is its body
# for a multipart email, the payload is returned as a python list of Messages
        # Message 0 should be the main body,
        # Message 1 is where we expect the dpatch to live
        # decode=True decodes the message according to the MIME information
        # For instance, darcs patches are sent as quoted-printable
        print email.get_payload()[1].get_payload(decode=True)
        raise Http404

--
--Max Battcher--
http://worldmaker.net
_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to