Thanks. I updated the fix and the tests.
On Nov 2, 2005, at 3:50 PM, Justin Johnson wrote:
> _cmdLineQuoteRe = re.compile(r'(\\*)"')
> def _cmdLineQuote(s):
> - return '"' + _cmdLineQuoteRe.sub(r'\1\1\\"', s) + '"'
> + quote = ((" " in s) or ("\t" in s)) and '"' or ''
> + return quote + _cmdLineQuoteRe.sub(r'\1\1\\"', s) + quote
That should be checking for a doublequote in addition to space and tab.
Also I just noticed another bug:
With input string (two characters):
"\
the output should be (6 chars):
"\"\\"
but is currently completely incorrect:
"\"\"
I think that second can be fixed with:
_cmdLineQuoteRe = re.compile(r'(\\*)"')
_cmdLineQuoteRe2 = re.compile(r'(\\+)\Z')
def _cmdLineQuote(s):
return '"' + _cmdLineQuoteRe2.sub(r"\1\1", _cmdLineQuoteRe.sub
(r'\1\1\\"', s)) + '"'
James
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python