Attempting to PATCH an invalid attribute on a member object in REST API results in 500, instead of 400.

Bug #833376 reported by Stephen A. Goss on 2011-08-24
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Mailman
Medium
Barry Warsaw

Bug Description

If you send a PATCH request to a member with an invalid parameter (anything other than "address", at the moment) you get a 500 response, instead of a 400 Bad Request. Here is the unhandled exception generating the 500 error:

Traceback (most recent call last):
  File "/usr/lib64/python2.6/wsgiref/handlers.py", line 93, in run
    self.result = application(self.environ, self.start_response)
  File "/home/sgoss/mailman_clone/src/mailman/rest/wsgiapp.py", line 58, in __call__
    environ, start_response)
  File "/home/sgoss/phoenix-deploy/lib/python2.6/site-packages/restish-0.12.1-py2.6.egg/restish/app.py", line 18, in __call__
    response = self.get_response(request, resource_or_response)
  File "/home/sgoss/phoenix-deploy/lib/python2.6/site-packages/restish-0.12.1-py2.6.egg/restish/app.py", line 65, in get_response
    resource_or_response = resource_or_response(request)
  File "/home/sgoss/phoenix-deploy/lib/python2.6/site-packages/restish-0.12.1-py2.6.egg/restish/resource.py", line 212, in __call__
    return _dispatch(request, match, lambda r: callable(self, r))
  File "/home/sgoss/phoenix-deploy/lib/python2.6/site-packages/restish-0.12.1-py2.6.egg/restish/resource.py", line 243, in _dispatch
    response = func(request)
  File "/home/sgoss/phoenix-deploy/lib/python2.6/site-packages/restish-0.12.1-py2.6.egg/restish/resource.py", line 212, in <lambda>
    return _dispatch(request, match, lambda r: callable(self, r))
  File "/home/sgoss/mailman_clone/src/mailman/rest/helpers.py", line 199, in __call__
    return self.func(resource, request)
  File "/home/sgoss/mailman_clone/src/mailman/rest/members.py", line 129, in patch_membership
    values = Validator(address=unicode)(request)
  File "/home/sgoss/mailman_clone/src/mailman/rest/validator.py", line 88, in __call__
    raise ValueError('Unexpected parameters: {0}'.format(extras))
ValueError: Unexpected parameters: delivery_mode

Related branches

Stephen A. Goss (postfuturist) wrote :

Here's a simple fix.

Barry Warsaw (barry) on 2011-09-02
Changed in mailman:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Barry Warsaw (barry)
milestone: none → 3.0.0a8
status: Confirmed → Fix Committed
Barry Warsaw (barry) on 2011-09-25
Changed in mailman:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers