Thanks. I updated the fix and the tests.<br><br>
<div><span class="gmail_quote">On 11/2/05, <b class="gmail_sendername">James Y Knight</b> <<a href="mailto:foom@fuhm.net">foom@fuhm.net</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">On Nov 2, 2005, at 3:50 PM, Justin Johnson wrote:<br>> _cmdLineQuoteRe = re.compile(r'(\\*)"')<br>
> def _cmdLineQuote(s):<br>> - return '"' + _cmdLineQuoteRe.sub(r'\1\1\\"', s) + '"'<br>> + quote = ((" " in s) or ("\t" in s)) and '"' or ''<br>> + return quote + _cmdLineQuoteRe.sub(r'\1\1\\"', s) + quote
<br><br><br>That should be checking for a doublequote in addition to space and tab.<br><br>Also I just noticed another bug:<br>With input string (two characters):<br>"\<br>the output should be (6 chars):<br>"\"\\"
<br>but is currently completely incorrect:<br>"\"\"<br><br>I think that second can be fixed with:<br>_cmdLineQuoteRe = re.compile(r'(\\*)"')<br>_cmdLineQuoteRe2 = re.compile(r'(\\+)\Z')<br>def _cmdLineQuote(s):
<br> return '"' + _cmdLineQuoteRe2.sub(r"\1\1", _cmdLineQuoteRe.sub<br>(r'\1\1\\"', s)) + '"'<br><br>James<br><br>_______________________________________________<br>Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br><a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
</a><br></blockquote></div><br>