Commit de74644e authored by Piergiorgio Pancino's avatar Piergiorgio Pancino

correct bug on receiving a bytestring, removed exception catching to avoid...

correct bug on receiving a bytestring, removed exception catching to avoid silent passing behaviour'
parent 661d4387
......@@ -124,12 +124,13 @@ def improve_logger(logger_instance):
"""
def __hex_format(ch):
if isinstance(ch, int):
# given a byte
return "\\x%02x" % ch
# given a string of one char
return "\\x%02x" % ord(ch)
try:
return "".join(map(__hex_format, instr))
except:
return instr
return "".join(map(__hex_format, instr))
# Appending methods to decorated class
logger_instance.debugon = types.MethodType(debugon, logger_instance)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment