summaryrefslogtreecommitdiff
path: root/src/mailman/rest/helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/rest/helpers.py')
-rw-r--r--src/mailman/rest/helpers.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mailman/rest/helpers.py b/src/mailman/rest/helpers.py
index f67d9d448..0bc312b1f 100644
--- a/src/mailman/rest/helpers.py
+++ b/src/mailman/rest/helpers.py
@@ -92,11 +92,12 @@ class ExtendedEncoder(json.JSONEncoder):
def etag(resource):
"""Calculate the etag and return a JSON representation.
- The input is a dictionary representing the resource. This dictionary must
- not contain an `http_etag` key. This function calculates the etag by
- using the sha1 hexdigest of the repr of the dictionary. It then inserts
- this value under the `http_etag` key, and returns the JSON representation
- of the modified dictionary.
+ The input is a dictionary representing the resource. This
+ dictionary must not contain an `http_etag` key. This function
+ calculates the etag by using the sha1 hexdigest of the
+ pretty-printed (and thus key-sorted and predictable) representation
+ of the dictionary. It then inserts this value under the `http_etag`
+ key, and returns the JSON representation of the modified dictionary.
:param resource: The original resource representation.
:type resource: dictionary