~smoser/simplestreams/trunk

« back to all changes in this revision

Viewing changes to simplestreams/util.py

  • Committer: Scott Moser
  • Date: 2016-01-25 18:03:00 UTC
  • Revision ID: smoser@ubuntu.com-20160125180300-1cao6xlwsbky7cj7
dump_data: dump json data with sorted keys

make dump_data use sorted keys for dictionaries.
The desire is to reduce differences in output that would otherwise
be the same.

Show diffs side-by-side

added added

removed removed

Lines of Context:
324
324
 
325
325
 
326
326
def dump_data(data):
327
 
    return json.dumps(data, indent=1).encode('utf-8')
 
327
    return json.dumps(data, indent=1, sort_keys=True,
 
328
                      separators=(',', ': ')).encode('utf-8')
328
329
 
329
330
 
330
331
def timestamp(ts=None):