diff options
| author | Barry Warsaw | 2015-02-13 03:13:06 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2015-02-13 03:13:06 -0500 |
| commit | 6d2c66ce133cd2c119fcb462dff662621013631a (patch) | |
| tree | 8ce6043cc9e95fc9bcb5ba5dab720e8b73a8c56b /src/mailman/rest/root.py | |
| parent | 7ffb6d2d43471486997c78c3cffa787a10560ecf (diff) | |
| download | mailman-6d2c66ce133cd2c119fcb462dff662621013631a.tar.gz mailman-6d2c66ce133cd2c119fcb462dff662621013631a.tar.zst mailman-6d2c66ce133cd2c119fcb462dff662621013631a.zip | |
Diffstat (limited to 'src/mailman/rest/root.py')
| -rw-r--r-- | src/mailman/rest/root.py | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/mailman/rest/root.py b/src/mailman/rest/root.py index d4dca146e..0861a9a5b 100644 --- a/src/mailman/rest/root.py +++ b/src/mailman/rest/root.py @@ -29,10 +29,11 @@ from mailman.config import config from mailman.core.constants import system_preferences from mailman.core.system import system from mailman.interfaces.listmanager import IListManager +from mailman.model.uid import UID from mailman.rest.addresses import AllAddresses, AnAddress from mailman.rest.domains import ADomain, AllDomains from mailman.rest.helpers import ( - BadRequest, NotFound, child, etag, not_found, okay, path_to) + BadRequest, NotFound, child, etag, no_content, not_found, okay, path_to) from mailman.rest.lists import AList, AllLists, Styles from mailman.rest.members import AMember, AllMembers, FindMembers from mailman.rest.preferences import ReadOnlyPreferences @@ -42,6 +43,9 @@ from mailman.rest.users import AUser, AllUsers from zope.component import getUtility +SLASH = '/' + + class Root: """The RESTful root resource. @@ -110,6 +114,25 @@ class SystemConfiguration: okay(response, etag(resource)) +class Reserved: + """Top level API for reserved operations. + + Nothing under this resource should be considered part of the stable API. + The resources that appear here are purely for the support of external + non-production systems, such as testing infrastructures for cooperating + components. Use at your own risk. + """ + def __init__(self, segments): + self._resource_path = SLASH.join(segments) + + def on_delete(self, request, response): + if self._resource_path != 'uids/orphans': + not_found(response) + return + UID.cull_orphans() + no_content(response) + + class TopLevel: """Top level collections and entries.""" @@ -226,3 +249,8 @@ class TopLevel: return AQueueFile(segments[0], segments[1]), [] else: return BadRequest(), [] + + @child() + def reserved(self, request, segments): + """/<api>/reserved/[...]""" + return Reserved(segments), [] |
