Barry Warsaw pushed to branch master at mailman / Mailman

Commits:
1ef59d99 by Aurélien Bompard at 2015-11-21T11:32:04Z
Sort the JSON keys in dev mode

This makes it much easier to compare VCR tapes.

- - - - -
0226456b by Barry Warsaw at 2015-11-21T12:07:27Z
Sort the JSON output when [devmode]enabled is true.

- - - - -


2 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/rest/helpers.py


Changes:

=====================================
src/mailman/docs/NEWS.rst
=====================================
--- a/src/mailman/docs/NEWS.rst
+++ b/src/mailman/docs/NEWS.rst
@@ -96,6 +96,8 @@ REST
  * Fix pagination values `start` and `total_size` in the REST API.  Given by
    Aurélien Bompard.  (Closes: #154)
  * JSON representations for held message now include a ``self_link``.
+ * When ``[devmode]enabled`` is set, the JSON output is sorted.  Given by
+   Aurélien Bompard.
 
 Other
 -----


=====================================
src/mailman/rest/helpers.py
=====================================
--- a/src/mailman/rest/helpers.py
+++ b/src/mailman/rest/helpers.py
@@ -112,7 +112,8 @@ def etag(resource):
     hashfood = pformat(resource).encode('raw-unicode-escape')
     etag = hashlib.sha1(hashfood).hexdigest()
     resource['http_etag'] = '"{0}"'.format(etag)
-    return json.dumps(resource, cls=ExtendedEncoder)
+    return json.dumps(resource, cls=ExtendedEncoder,
+                      sort_keys=as_boolean(config.devmode.enabled))
 
 
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/e2c50f1e10a485a79183e99e0e78b93673b8a8a7...0226456bc4cae5f8f4273fdec5b7a9b41bbee072
_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to