Skip to content

Commit

Permalink
Implementation of dropbox#142: Made the implementation cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
Narayanan Seshan committed Sep 1, 2017
1 parent 3834502 commit 85135cf
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions pynsot/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ def pretty_dict(data, delim='=', sep=', ', joiner='\n'):
"""
log.debug('PRETTY DICT INCOMING DATA = %r', data)
pretty = ''
for key, val in data.iteritems():
for key, val in sorted(data.iteritems()):
val = data[key]
if isinstance(val, list):
# Sort, add a newline and indent so that nested value items
# look better.
Expand All @@ -167,11 +168,7 @@ def pretty_dict(data, delim='=', sep=', ', joiner='\n'):
val = joiner + val # Prefix it w/ newline for readability
pretty += '%s%s%s%s' % (key, delim, val, sep)

pretty = pretty.rstrip(sep) # Drop the trailing separator
pretty = pretty.split('\n')
pretty.sort()
pretty = '\n'.join(pretty)
return pretty
return pretty.rstrip(sep) # Drop the trailing separator

def format_message(self, obj_single, message=''):
"""
Expand Down

0 comments on commit 85135cf

Please sign in to comment.