Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Better API on DocumentingTemplateRenderer for escaping content.
class DocumentingTemplateRenderer(BaseRenderer):
escape_binary = True
def _escape_binary(content):
if self.escape_binary and not all(char in string.printable for char in content):
return '[%d bytes of binary content]' % len(content)
return content
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.