diff options
| author | Barry Warsaw | 2015-07-19 15:40:07 +0000 |
|---|---|---|
| committer | Barry Warsaw | 2015-07-19 15:40:07 +0000 |
| commit | d903aa4ba57dc19699972bf22b7874edd90434a8 (patch) | |
| tree | 32fa44f854cf762b156c93ecba1a63be43e454c5 /src/mailman/rest/root.py | |
| parent | fddfcbde937f61657bb29253609b63670beaae46 (diff) | |
| parent | 5a08c47353cefccaa021e0f488ab76f3806dd49c (diff) | |
| download | mailman-d903aa4ba57dc19699972bf22b7874edd90434a8.tar.gz mailman-d903aa4ba57dc19699972bf22b7874edd90434a8.tar.zst mailman-d903aa4ba57dc19699972bf22b7874edd90434a8.zip | |
Diffstat (limited to 'src/mailman/rest/root.py')
| -rw-r--r-- | src/mailman/rest/root.py | 21 |
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)) |
