Created
September 21, 2011 07:52
-
-
Save tomchristie/1231497 to your computer and use it in GitHub Desktop.
Better API on DocumentingTemplateRenderer for escaping content.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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