Skip to content

Commit

Permalink
Merge pull request #683 from grycap/devel
Browse files Browse the repository at this point in the history
Fix #682
  • Loading branch information
micafer authored Oct 2, 2018
2 parents 4ac8d19 + 552456b commit 5f7161a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions IM/REST.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def format_output(res, default_type="text/plain", field_name=None, list_field_na
if isinstance(res, list):
info = "\n".join(res)
else:
info = str(res)
info = "%s" % res
content_type = default_type
break

Expand All @@ -299,7 +299,7 @@ def format_output(res, default_type="text/plain", field_name=None, list_field_na
if isinstance(res, list):
info = "\n".join(res)
else:
info = str(res)
info = "%s" % res
bottle.response.content_type = default_type

return info
Expand Down
3 changes: 3 additions & 0 deletions test/unit/REST.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,9 @@ def test_format_output(self, get_media_type):
info = format_output(["1", "2"])
self.assertEqual(info, '1\n2')

info = format_output(u'contmsg\xe1', field_name="contmsg", default_type="text/plain")
self.assertEqual(info, u'contmsg\xe1')

get_media_type.return_value = ["application/zip"]
info = format_output(["1", "2"])
self.assertEqual(info, 'Unsupported Accept Media Types: application/zip')
Expand Down

0 comments on commit 5f7161a

Please sign in to comment.