------------------------------------------------------------
revno: 6756
committer: Barry Warsaw <[email protected]>
branch nick: 3.0
timestamp: Thu 2009-08-06 17:05:53 -0400
message:
Fix the turning of application level exceptions into HTTP 400 errors, through
the improvement of the publication's handleException() method.
Pick some lint in traverse.py.
modified:
src/mailman/interfaces/listmanager.py
src/mailman/rest/docs/lists.txt
src/mailman/rest/publication.py
src/mailman/rest/traverse.py
--
lp:mailman
https://code.launchpad.net/~mailman-coders/mailman/3.0
Your team Mailman Checkins is subscribed to branch lp:mailman.
To unsubscribe from this branch go to
https://code.launchpad.net/~mailman-coders/mailman/3.0/+edit-subscription.
=== modified file 'src/mailman/interfaces/listmanager.py'
--- src/mailman/interfaces/listmanager.py 2009-07-27 01:23:02 +0000
+++ src/mailman/interfaces/listmanager.py 2009-08-06 21:05:53 +0000
@@ -27,7 +27,7 @@
from lazr.restful.declarations import (
- collection_default_content, export_as_webservice_collection,
+ collection_default_content, error_status, export_as_webservice_collection,
export_factory_operation)
from zope.interface import Interface, Attribute
@@ -36,6 +36,7 @@
+...@error_status(400)
class ListAlreadyExistsError(MailmanError):
"""Attempted to create a mailing list that already exists.
=== modified file 'src/mailman/rest/docs/lists.txt'
--- src/mailman/rest/docs/lists.txt 2009-07-27 01:23:02 +0000
+++ src/mailman/rest/docs/lists.txt 2009-08-06 21:05:53 +0000
@@ -64,7 +64,9 @@
... 'ws.op': 'new',
... 'fqdn_listname': '[email protected]',
... })
- XXX
+ Traceback (most recent call last):
+ ...
+ HTTPError: HTTP Error 400: Bad Request
Nor can you create a mailing list that already exists.
@@ -72,4 +74,6 @@
... 'ws.op': 'new',
... 'fqdn_listname': '[email protected]',
... })
- XXX
+ Traceback (most recent call last):
+ ...
+ HTTPError: HTTP Error 400: Bad Request
=== modified file 'src/mailman/rest/publication.py'
--- src/mailman/rest/publication.py 2009-07-11 01:55:26 +0000
+++ src/mailman/rest/publication.py 2009-08-06 21:05:53 +0000
@@ -85,11 +85,21 @@
"""See `IPublication`."""
# Any in-progress transaction must be aborted.
config.db.abort()
+ # Reproduce the behavior of ZopePublication by looking up a view
+ # for this exception.
exception = exc_info[1]
+ # XXX BAW 2009-08-06 This should not be necessary. I need to register
+ # a view so that 404 will be returned for a NotFound.
if isinstance(exception, NotFound):
request.response.reset()
request.response.setStatus(404)
request.response.setResult('')
+ return
+ view = queryMultiAdapter((exception, request), name='index.html')
+ if view is not None:
+ exc_info = None
+ request.response.reset()
+ request.response.setResult(view())
else:
traceback.print_exception(*exc_info)
=== modified file 'src/mailman/rest/traverse.py'
--- src/mailman/rest/traverse.py 2009-05-02 22:07:38 +0000
+++ src/mailman/rest/traverse.py 2009-08-06 21:05:53 +0000
@@ -17,6 +17,10 @@
"""Traversal rules for the Mailman RESTful admin web service."""
+# XXX BAW 2009-08-06 Can we get rid of this module? It only seems to be used
+# for NotFound traversals from the top level. See the failure in basic.txt if
+# we remove this module.
+
from __future__ import absolute_import, unicode_literals
__metaclass__ = type
@@ -27,12 +31,8 @@
from urllib import unquote
-from zope.component import adapts
from zope.interface import implements
from zope.publisher.interfaces import IPublishTraverse, NotFound
-from zope.publisher.interfaces.browser import IDefaultBrowserLayer
-
-from mailman.interfaces.rest import IHasGet
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org