diff options
| author | Barry Warsaw | 2017-05-23 12:32:03 -0700 |
|---|---|---|
| committer | Barry Warsaw | 2017-05-23 12:39:39 -0700 |
| commit | 3bd2a292b7300ce354de1ed405dc8665311acd9f (patch) | |
| tree | 4ce714a6e9b964a673211246c8ba25219e430e79 /src/mailman/rest/root.py | |
| parent | a7c563e9048d302c52558e6e2202fdfb49961843 (diff) | |
| download | mailman-3bd2a292b7300ce354de1ed405dc8665311acd9f.tar.gz mailman-3bd2a292b7300ce354de1ed405dc8665311acd9f.tar.zst mailman-3bd2a292b7300ce354de1ed405dc8665311acd9f.zip | |
Diffstat (limited to 'src/mailman/rest/root.py')
| -rw-r--r-- | src/mailman/rest/root.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mailman/rest/root.py b/src/mailman/rest/root.py index 76cf2ba25..76289078b 100644 --- a/src/mailman/rest/root.py +++ b/src/mailman/rest/root.py @@ -89,7 +89,9 @@ class SystemConfiguration: def on_get(self, request, response): if self._section is None: resource = dict( - sections=sorted(section.name for section in config)) + sections=sorted(section.name for section in config), + self_link=self.api.path_to('system/configuration'), + ) okay(response, etag(resource)) return missing = object() @@ -100,6 +102,14 @@ class SystemConfiguration: # Sections don't have .keys(), .values(), or .items() but we can # iterate over them. resource = {key: section[key] for key in section} + # Add a `self_link` attribute to the resource. This is a little ugly + # because technically speaking we're mixing namespaces. We can't have + # a variable named `self_link` in any section, but also we can't have + # `http_etag` either, so unless we want to shove all these values into + # a sub dictionary (which we don't), we have to live with it. + self_link = self.api.path_to( + 'system/configuration/{}'.format(section.name)) + resource['self_link'] = self_link okay(response, etag(resource)) |
