# HG changeset patch # User Paul Boddie # Date 1372177724 -7200 # Node ID f2cdf0361901f0fcfb961f4e4b14a40f11388683 # Parent 7ddc1c5c0c727d512f69d84e4bd517322f33f11e Changed the fetching of messages to use the GET request method. diff -r 7ddc1c5c0c72 -r f2cdf0361901 MoinMessage.py --- a/MoinMessage.py Sat Jun 22 02:08:15 2013 +0200 +++ b/MoinMessage.py Tue Jun 25 18:28:44 2013 +0200 @@ -416,9 +416,12 @@ else: message["Date"] = datestr -def sendMessage(message, url): +def sendMessage(message, url, method="PUT"): - "Send 'message' to the given 'url." + """ + Send 'message' to the given 'url' using the given 'method' (using PUT as the + default if omitted). + """ scheme, host, port, path = parseURL(url) text = message.as_string() @@ -431,7 +434,7 @@ raise MoinMessageError, "Communications protocol not supported: %s" % scheme req = cls(host, port) - req.request("PUT", path, text) + req.request(method, path, text) resp = req.getresponse() if resp.status >= 400: diff -r 7ddc1c5c0c72 -r f2cdf0361901 README.txt --- a/README.txt Sat Jun 22 02:08:15 2013 +0200 +++ b/README.txt Tue Jun 25 18:28:44 2013 +0200 @@ -273,5 +273,15 @@ the content is stored in a message store associated with the Wiki page. Each update may describe multiple representations of some content by employing -a multipart section containing parts for each of the representations. -Alternatively, a single message part may describe a single representation. +a multipart/alternative section containing parts for each of the +representations. Alternatively, a single message part may describe a single +representation. + +HTTP Methods +------------ + +Since MoinMoin seems to reserve POST methods for request/entity bodies that +contain HTML form data, it is necessary to use alternative methods to post +messages to a site served by MoinMoin and to fetch messages from such a site. +Consequently, MoinMessage uses PUT to post messages and recommends GET to +fetch messages. diff -r 7ddc1c5c0c72 -r f2cdf0361901 tests/test_fetch.py --- a/tests/test_fetch.py Sat Jun 22 02:08:15 2013 +0200 +++ b/tests/test_fetch.py Tue Jun 25 18:28:44 2013 +0200 @@ -29,7 +29,7 @@ try: signed_message = gpg.signMessage(email_message, signer) encrypted_message = gpg.encryptMessage(signed_message, recipient) - print sendMessage(encrypted_message, url) + print sendMessage(encrypted_message, url, "GET") except MoinMessageError, exc: print exc