summaryrefslogtreecommitdiff
path: root/src/mailman/rest/helpers.py
diff options
context:
space:
mode:
authorBarry Warsaw2014-11-08 10:27:56 -0500
committerBarry Warsaw2014-11-08 10:27:56 -0500
commitd8ed610f3613847d6b1dbba9dbad7654ef681efb (patch)
treed542614f93fae558f9576fdf7158c7cd9d7e37bb /src/mailman/rest/helpers.py
parent59f980abc3aa10e0ff8a3d38ed91d69f68b194ed (diff)
parent410b2fae5eaba2e4bb6c2ebdc86d99eab4effc56 (diff)
downloadmailman-d8ed610f3613847d6b1dbba9dbad7654ef681efb.tar.gz
mailman-d8ed610f3613847d6b1dbba9dbad7654ef681efb.tar.zst
mailman-d8ed610f3613847d6b1dbba9dbad7654ef681efb.zip
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