summaryrefslogtreecommitdiff
path: root/src/mailman/rest/root.py
diff options
context:
space:
mode:
authorBarry Warsaw2015-07-04 14:58:45 -0400
committerBarry Warsaw2015-07-18 23:21:05 -0400
commit759efff6eb63b3ba1fff15193923a3df72eb552c (patch)
tree97d61b867217476be4ef58de389644ee88d0ed13 /src/mailman/rest/root.py
parentfddfcbde937f61657bb29253609b63670beaae46 (diff)
downloadmailman-759efff6eb63b3ba1fff15193923a3df72eb552c.tar.gz
mailman-759efff6eb63b3ba1fff15193923a3df72eb552c.tar.zst
mailman-759efff6eb63b3ba1fff15193923a3df72eb552c.zip
Diffstat (limited to 'src/mailman/rest/root.py')
-rw-r--r--src/mailman/rest/root.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/mailman/rest/root.py b/src/mailman/rest/root.py
index 9ec84da68..ca8bbc4a9 100644
--- a/src/mailman/rest/root.py
+++ b/src/mailman/rest/root.py
@@ -56,8 +56,22 @@ class Root:
always be the case though.
"""
- @child(config.webservice.api_version)
- def api_version(self, request, segments):
+ @child('3.0')
+ def api_version_30(self, request, segments):
+ # API version 3.0 was introduced in Mailman 3.0.
+ request.context['api_version'] = '3.0'
+ return self._check_authorization(request, segments)
+
+ @child('3.1')
+ def api_version_31(self, request, segments):
+ # API version 3.1 was introduced in Mailman 3.1. Primary backward
+ # incompatible difference is that uuids are represented as hex strings
+ # instead of 128 bit integers. The latter is not compatible with all
+ # versions of JavaScript.
+ request.context['api_version'] = '3.1'
+ return self._check_authorization(request, segments)
+
+ def _check_authorization(self, request, segments):
# We have to do this here instead of in a @falcon.before() handler
# because those handlers are not compatible with our custom traversal
# logic. Specifically, falcon's before/after handlers will call the
@@ -88,7 +102,8 @@ class Versions:
resource = dict(
mailman_version=system.mailman_version,
python_version=system.python_version,
- self_link=path_to('system/versions'),
+ api_version=self.api_version,
+ self_link=path_to('system/versions', self.api_version),
)
okay(response, etag(resource))