PappyProxy/pappyproxy/util.py
2016-01-19 18:00:34 -06:00

24 lines
589 B
Python

import string
class PappyException(Exception):
"""
The exception class for Pappy. If a plugin command raises one of these, the
message will be printed to the console rather than displaying a traceback.
"""
pass
def printable_data(data):
"""
Return ``data``, but replaces unprintable characters with periods.
:param data: The data to make printable
:type data: String
:rtype: String
"""
chars = []
for c in data:
if c in string.printable:
chars += c
else:
chars += '.'
return ''.join(chars)