~sambuddhabasu1/mailman/fix_mailman_run_error

« back to all changes in this revision

Viewing changes to src/mailman/rest/helpers.py

  • Committer: Barry Warsaw
  • Date: 2014-11-08 15:27:56 UTC
  • mfrom: (7255 3.0)
  • mto: This revision was merged to the branch mainline in revision 7260.
  • Revision ID: barry@list.org-20141108152756-p37fhmb0z2dtl7hx
Trunk merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
92
92
def etag(resource):
93
93
    """Calculate the etag and return a JSON representation.
94
94
 
95
 
    The input is a dictionary representing the resource.  This dictionary must
96
 
    not contain an `http_etag` key.  This function calculates the etag by
97
 
    using the sha1 hexdigest of the repr of the dictionary.  It then inserts
98
 
    this value under the `http_etag` key, and returns the JSON representation
99
 
    of the modified dictionary.
 
95
    The input is a dictionary representing the resource.  This
 
96
    dictionary must not contain an `http_etag` key.  This function
 
97
    calculates the etag by using the sha1 hexdigest of the
 
98
    pretty-printed (and thus key-sorted and predictable) representation
 
99
    of the dictionary.  It then inserts this value under the `http_etag`
 
100
    key, and returns the JSON representation of the modified dictionary.
100
101
 
101
102
    :param resource: The original resource representation.
102
103
    :type resource: dictionary