[Mailman-Developers] Problem passing parameters to the REST API

Barry Warsaw barry at list.org
Fri Jun 12 20:18:08 CEST 2015


On Jun 12, 2015, at 10:38 AM, khushboo surana wrote:

>I have also changed the 'on_delete()' method of the mailman/rest/members.py
>file to retrieve the data sent.

I'd like to see the diff, or the modified function.

>In the Core, I get the following logs:
>
>Traceback (most recent call last):
>  File "/usr/lib/python3.4/wsgiref/handlers.py", line 137, in run
>    self.result = application(self.environ, self.start_response)
>  File "/home/khushboo/gsoc/mailman/src/mailman/database/transaction.py",
>line 57, in wrapper
>    rtn = function(*args, **kws)
>  File "/home/khushboo/gsoc/mailman/src/mailman/rest/wsgiapp.py", line 65,
>in __call__
>    environ, start_response)
>  File
>"/home/khushboo/gsoc/mailman/lib/python3.4/site-packages/falcon-0.3.0-py3.4.egg/falcon/api.py",
>line 182, in __call__
>    responder(req, resp, **params)
>TypeError: on_delete() missing 1 required positional argument: 'response'

Is that the entire traceback?  I would have expected to see the on_delete()
method mentioned there.  There's probably a chained traceback in the log files
before the one you pasted.

Be sure you don't change the signature of the on_delete() method.  That must
take exactly three arguments: self, request, and response.  Normally, the way
on_patch() or on_post() dig parameters out of the data is through a
Validator() instance, which lists the parameters and their type conversion
methods.  You can see examples of this all over the rest submodule methods.

But on_delete() (really the HTTP DELETE method) doesn't accept any arguments
since its purpose is to delete a resource.

I'm not sure what your best option is for recording the "mode" of the
deletion.  I'm not sure whether it's technically acceptable to add data to a
DELETE method (the documentation and books I've consulted don't say either
way).  But it would definitely be out of the ordinary for Mailman's REST API.
Even if it were acceptable, I think this on_delete() method would at least
have to accept and do something reasonable with zero arguments (i.e. the mode
would be optional).

Cheers,
Barry



More information about the Mailman-Developers mailing list