summaryrefslogtreecommitdiff
path: root/src/mailman/rest/lists.py
diff options
context:
space:
mode:
authorBarry Warsaw2016-07-16 15:44:07 -0400
committerBarry Warsaw2016-07-16 15:44:07 -0400
commitdbde6231ec897379ed38ed4cd015b8ab20ed5fa1 (patch)
tree1226d06a238314262a1d04d0bbf9c4dc0b72c309 /src/mailman/rest/lists.py
parent3387791beb7112dbe07664041f117fdcc20df53d (diff)
downloadmailman-dbde6231ec897379ed38ed4cd015b8ab20ed5fa1.tar.gz
mailman-dbde6231ec897379ed38ed4cd015b8ab20ed5fa1.tar.zst
mailman-dbde6231ec897379ed38ed4cd015b8ab20ed5fa1.zip
Diffstat (limited to 'src/mailman/rest/lists.py')
-rw-r--r--src/mailman/rest/lists.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/mailman/rest/lists.py b/src/mailman/rest/lists.py
index 69d14e548..c3919c001 100644
--- a/src/mailman/rest/lists.py
+++ b/src/mailman/rest/lists.py
@@ -33,12 +33,13 @@ from mailman.interfaces.subscriptions import ISubscriptionService
from mailman.rest.bans import BannedEmails
from mailman.rest.header_matches import HeaderMatches
from mailman.rest.helpers import (
- CollectionMixin, GetterSetter, NotFound, accepted, bad_request, child,
- created, etag, no_content, not_found, okay)
+ BadRequest, CollectionMixin, GetterSetter, NotFound, accepted,
+ bad_request, child, created, etag, no_content, not_found, okay)
from mailman.rest.listconf import ListConfiguration
from mailman.rest.members import AMember, MemberCollection
from mailman.rest.post_moderation import HeldMessages
from mailman.rest.sub_moderation import SubscriptionRequests
+from mailman.rest.uris import AListURI, AllListURIs
from mailman.rest.validator import Validator, list_of_strings_validator
from zope.component import getUtility
@@ -204,6 +205,23 @@ class AList(_ListBase):
return NotFound(), []
return HeaderMatches(self._mlist)
+ @child()
+ def uris(self, context, segments):
+ """Return the template URIs of the mailing list.
+
+ These are only available after API 3.0.
+ """
+ if self._mlist is None or self.api.version_info < (3, 1):
+ return NotFound(), []
+ if len(segments) == 0:
+ return AllListURIs(self._mlist)
+ if len(segments) > 1:
+ return BadRequest(), []
+ template = segments[0]
+ if template not in AllListURIs.URIs:
+ return NotFound(), []
+ return AListURI(self._mlist, template), []
+
@public
class AllLists(_ListBase):