Fixed web_config prompt to work with Python 2.6.1

This commit is contained in:
Peter Ammon 2012-09-10 02:11:06 -07:00
parent f6fe3df59b
commit 86a978d9ee

View File

@ -185,13 +185,15 @@ def ansi_to_html(val):
# Split us up by ANSI escape sequences
# We want to catch not only the standard color codes, but also things like sgr0
# Hence this lame check
separated = re.split("""
# Note that Python 2.6 doesn't have a flag param to re.split, so we have to compile it first
reg = re.compile("""
( # Capture
\x1b # Escape
[^m]+ # One or more non-'m's
m # Literal m terminates the sequence
) # End capture
""", val, 0, re.VERBOSE)
""", re.VERBOSE)
separated = reg.split(val)
# We have to HTML escape the text and convert ANSI escapes into HTML
# Collect it all into this array