Moved escape mechanism to a central location in serversessionhandler.

This commit is contained in:
Griatch 2014-08-21 09:13:53 +02:00
parent 4e2dfef321
commit 6ae2ca6901
2 changed files with 12 additions and 4 deletions

View file

@ -189,9 +189,6 @@ class ANSIParser(object):
if not string:
return ''
# remove hard-coded strings
string = self.strip_raw_codes(string)
# check cached parsings
global _PARSE_CACHE
cachekey = "%s-%s-%s" % (string, strip_ansi, xterm256)
@ -337,6 +334,13 @@ def parse_ansi(string, strip_ansi=False, parser=ANSI_PARSER, xterm256=False):
return parser.parse_ansi(string, strip_ansi=strip_ansi, xterm256=xterm256)
def strip_raw_ansi(string, parser=ANSI_PARSER):
"""
Remove raw ansi codes from string
"""
return parser.strip_raw_codes(string)
def raw(string):
"""
Escapes a string into a form which won't be colorized by the ansi parser.