diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/rest/publication.py | 5 | ||||
| -rw-r--r-- | src/mailman/rest/traverse.py | 53 | ||||
| -rw-r--r-- | src/mailman/rest/webservice.py | 1 |
3 files changed, 5 insertions, 54 deletions
diff --git a/src/mailman/rest/publication.py b/src/mailman/rest/publication.py index 2de9c8120..6d25366ad 100644 --- a/src/mailman/rest/publication.py +++ b/src/mailman/rest/publication.py @@ -66,7 +66,10 @@ class Publication: resolver = IResolvePathNames(ob, missing) if resolver is missing: raise NotFound(ob, name, request) - return ob.get(name) + next_step = ob.get(name) + if next_step is None: + raise NotFound(ob, name, request) + return next_step def afterTraversal(self, request, ob): """See `IPublication`.""" diff --git a/src/mailman/rest/traverse.py b/src/mailman/rest/traverse.py deleted file mode 100644 index ee8f3925c..000000000 --- a/src/mailman/rest/traverse.py +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (C) 2009 by the Free Software Foundation, Inc. -# -# This file is part of GNU Mailman. -# -# GNU Mailman is free software: you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation, either version 3 of the License, or (at your option) -# any later version. -# -# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# GNU Mailman. If not, see <http://www.gnu.org/licenses/>. - -"""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 -__all__ = [ - 'Traverse', - ] - - -from urllib import unquote - -from zope.interface import implements -from zope.publisher.interfaces import IPublishTraverse, NotFound - - - -class Traverse: - """An implementation of `IPublishTraverse` that uses the get() method.""" - - implements(IPublishTraverse) - - def __init__(self, context, request): - self.context = context - - def publishTraverse(self, request, name): - """See `IPublishTraverse`.""" - name = unquote(name) - value = self.context.get(name) - if value is None: - raise NotFound(self, name) - return value diff --git a/src/mailman/rest/webservice.py b/src/mailman/rest/webservice.py index 054b04ae9..e9f683a7c 100644 --- a/src/mailman/rest/webservice.py +++ b/src/mailman/rest/webservice.py @@ -37,6 +37,7 @@ from wsgiref.simple_server import WSGIServer, WSGIRequestHandler from lazr.restful.publisher import WebServiceRequestTraversal from zope.interface import implements from zope.publisher.browser import BrowserRequest +from zope.publisher.interfaces import NotFound from zope.publisher.publish import publish from mailman.config import config |
