preferences.save() returns an HTTP error 400 all the time
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Mailman REST Client |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
In the docs, it is written that preferences can be modified by calling the save() method, but there were no doctests for this and indeed it seems broken. I've added the following lines to using.txt:
=== modified file 'src/mailmancli
--- src/mailmanclie
+++ src/mailmanclie
@@ -522,6 +522,12 @@
Preferences can be set, but you have to call ``save`` to make your changes permanent.
+ >>> prefs = test_two.
+ >>> prefs['
+ >>> prefs.save()
+ >>> prefs = test_two.
+ >>> print prefs['
+ by_user
Owners and Moderators
======
And I get these errors when running the test suite:
-------
File "/srv/dev/
Failed example:
prefs.save()
Exception raised:
Traceback (most recent call last):
File "/usr/lib64/
File "<doctest using.txt[152]>", line 1, in <module>
File "/srv/dev/
response, content = self._connectio
File "/srv/dev/
raise HTTPError(url, response.status, content, response, None)
HTTPError: HTTP Error 400: Unexpected parameters: http_etag, self_link
-------
File "/srv/dev/
Failed example:
print prefs['
Differences (ndiff with -expected +actual):
- by_user
+ None
-------
It looks like the http_etag and self_link values should be filtered out of the preferences dictionary.
But when I do that in _client.py, I get another error:
-------
File "/srv/dev/
Failed example:
prefs.save()
Exception raised:
Traceback (most recent call last):
File "/usr/lib64/
File "<doctest using.txt[152]>", line 1, in <module>
File "/srv/dev/
response, content = self._connectio
File "/srv/dev/
raise HTTPError(url, response.status, content, response, None)
HTTPError: HTTP Error 400: Missing parameters: acknowledge_posts, receive_list_copy, receive_
-------
Apparently the PUT method requires all parameters to be sent, even when they are None. It works with the PATCH method however, using the attached patch. Could it be merged ?
summary: |
- preferences.save() returns a 405 error all the time + preferences.save() returns an HTTP error 400 all the time |
Changed in mailman.client: | |
milestone: | none → 1.0.0a1 |
Hi Aurélien,
thanks for the patch! The bug itself had already been fixed a while ago, but I've added the doctests for that anyway since there were none yet.
Thanks again and sorry for the late reply...
Florian