From 86a978d9ee80f5a97c3fba822c6b95fdc60f6a22 Mon Sep 17 00:00:00 2001 From: Peter Ammon Date: Mon, 10 Sep 2012 02:11:06 -0700 Subject: [PATCH] Fixed web_config prompt to work with Python 2.6.1 --- share/tools/web_config/webconfig.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/share/tools/web_config/webconfig.py b/share/tools/web_config/webconfig.py index a90b07a20..02d8e3633 100755 --- a/share/tools/web_config/webconfig.py +++ b/share/tools/web_config/webconfig.py @@ -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