mirror of
https://github.com/evennia/evennia.git
synced 2026-04-04 15:07:16 +02:00
Moved escape mechanism to a central location in serversessionhandler.
This commit is contained in:
parent
4e2dfef321
commit
6ae2ca6901
2 changed files with 12 additions and 4 deletions
|
|
@ -1096,9 +1096,13 @@ class lazy_property(object):
|
|||
obj.__dict__[self.__name__] = value
|
||||
return value
|
||||
|
||||
_STRIP_ANSI = None
|
||||
_RE_CONTROL_CHAR = re.compile('[%s]' % re.escape(''.join([unichr(c) for c in range(0,32) + range(127,160)])))
|
||||
def escape_control_sequences(string):
|
||||
"""
|
||||
remove non-print text sequences from string.
|
||||
"""
|
||||
return _RE_CONTROL_CHAR.sub('', string)
|
||||
global _STRIP_ANSI
|
||||
if not _STRIP_ANSI:
|
||||
from src.utils.ansi import strip_raw_ansi as _STRIP_ANSI
|
||||
return _RE_CONTROL_CHAR.sub('', _STRIP_ANSI(string))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue