Skip to content
This repository has been archived by the owner on Feb 2, 2018. It is now read-only.

Commit

Permalink
models: str understands list and dict models.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashcrow authored and mbarnes committed Dec 15, 2016
1 parent b3d3090 commit c20831a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/commissaire/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ def __str__(self): # pragma: no cover
:rtype: str
"""
readable = '<{}'.format(self.__class__.__name__)
for k, v in self.to_dict_safe().items():
readable += ' {}={},'.format(k, v or '<Empty>')
if self._json_type == 'dict':
for k, v in self.to_dict_safe().items():
readable += ' {}={},'.format(k, v or '<Empty>')
elif self._json_type == 'list':
readable += ','.join(self.to_list_safe())
return readable + '...>'

@property
Expand Down

0 comments on commit c20831a

Please sign in to comment.