Better checking if the content can be printable in the BrowsableAPI

This commit is contained in:
Pablo Recio 2013-05-18 16:32:53 +02:00
parent 97f034e3d6
commit 6dbbbc16da

View File

@ -325,7 +325,7 @@ class BrowsableAPIRenderer(BaseRenderer):
renderer_context['indent'] = 4
content = renderer.render(data, accepted_media_type, renderer_context)
if not all(char in string.printable for char in content):
if not isinstance(content, six.text_type):
return '[%d bytes of binary content]'
return content