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

khushboo surana khushboo9293 at gmail.com
Fri Jun 12 07:08:22 CEST 2015


Hello,

I am working on Mailman to implement report generations for unsubscription
stats like no. of members who unsubscribed through different modes like
email confirmation. web-confirmation, etc. ( For more details refer:
http://systers.org/wiki/doku.php/f_dlist_stats_scripts)

I made changes in the Mailman Model to add attributes for date and mode of
unsubsrciption in the member table. I also changed the unsubscribe() method
in mailman/model/member.py file to accept another parameter called 'mode'
and add that to the member table.

I am trying to change all the methods in the Client and REST API that
access the unsubscribe method, to pass  the mode,  but I am facing
problems.

In the mailmanclient/_client.py file I have made the following changes:

def unsubscribe(self, email, mode):
     data = dict(mode = mode)
      for member in self.members:
            if member.email == email:
                self._connection.call(member.self_link, data=data,
method='DELETE')
                break


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

When I run mmclient in postorius and try to unsubscribe a member from the
list I get the following error:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/khushboo/gsoc/mailman.client/src/mailmanclient/_client.py",
line 619, in unsubscribe
    self._connection.call(member.self_link, data=data, method='DELETE')
  File "/home/khushboo/gsoc/mailman.client/src/mailmanclient/_client.py",
line 108, in call
    raise HTTPError(url, response.status, content, response, None)
HTTPError: HTTP Error 500: A server error occurred.  Please contact the
administrator.



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'


I am trying to debug the problem but haven't been able to make much
progress. Can someone please help figure out the problem.

Thanks
Khushboo


More information about the Mailman-Developers mailing list