Attempting to GET a nonexistent members object results in a 500 instead of a 404.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Mailman |
Fix Released
|
Medium
|
Barry Warsaw |
Bug Description
Attempting to GET a nonexistent members object results in a 500 instead of a 404.
$ curl -i -u restadmin:restpass http://
HTTP/1.0 500 Dude, this is whack!
Date: Thu, 04 Aug 2011 16:25:01 GMT
Server: WSGIServer/0.1 Python/2.6.5
Content-Type: text/plain
Content-Length: 59
A server error occurred. Please contact the administrator.
And here is the stack trace:
Traceback (most recent call last):
File "/usr/lib64/
self.result = application(
File "/home/
environ, start_response)
File "/home/
response = self.get_
File "/home/
resource_
File "/home/
return _dispatch(request, match, lambda r: callable(self, r))
File "/home/
response = func(request)
File "/home/
return _dispatch(request, match, lambda r: callable(self, r))
File "/home/
return http.ok([], self._resource_
File "/home/
return etag(self.
File "/home/
enum, dot, role = str(member.
AttributeError: 'NoneType' object has no attribute 'role'
The platform is Centos 6 (64 bit), system python (2.6.5) running in a --no-site-packages virtualenv with the following python libs:
$ pip freeze
WebOb==1.1beta1
argparse==1.2.1
decorator==3.3.1
distribute==0.6.8
flufl.bounce==0.91
flufl.enum==3.1
flufl.i18n==1.0.4
flufl.lock==2.1
httplib2==0.7.1
lazr.config==1.1.3
lazr.delegates=
lazr.smtptest==1.3
mailman==3.0.0a7-
mimeparse==0.1.3
restish==0.12.1
storm==0.18
zc.buildout==1.5.2
zope.component=
zope.configurat
zope.event==3.5.0-1
zope.exceptions
zope.i18nmessag
zope.interface=
zope.schema==3.8.0
zope.testing=
tags: | added: mailman3 |
Changed in mailman: | |
status: | Fix Committed → Fix Released |
It's a simple omission in the REST code. Here's the fix:
=== modified file 'src/mailman/ rest/members. py' rest/members. py 2011-04-26 02:23:05 +0000 rest/members. py 2011-08-09 21:39:07 +0000 GET() as_json( self._member) )
--- src/mailman/
+++ src/mailman/
@@ -75,6 +75,8 @@
@resource.
def member(self, request):
"""Return a single member end-point."""
+ if self._member is None:
+ return http.not_found()
return http.ok([], self._resource_
@resource. DELETE( )