Skip to content

Commit

Permalink
Implementation for dropbox#142: Moved sorting logic to pretty_dict()
Browse files Browse the repository at this point in the history
  • Loading branch information
Narayanan Seshan committed Sep 1, 2017
1 parent a7428c7 commit 53d86a8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pynsot/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ 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)

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

def format_message(self, obj_single, message=''):
"""
Expand Down Expand Up @@ -333,11 +337,6 @@ def format_field(self, field, field_data):
elif field == 'change_at': # Timestamp
field_data = self.format_timestamp(field_data)

elif field == 'attributes':
field_data = field_data.split('\n')
field_data.sort()
field_data = '\n'.join(field_data)

return field_data

def format_object_for_grep(self, obj):
Expand Down

0 comments on commit 53d86a8

Please sign in to comment.