[Twisted-Python] Re: [Twisted-commits] r15000 - Potential fix for issue1123.

Justin Johnson justinjohnson at gmail.com
Thu Nov 3 09:35:00 EST 2005


Thanks. I updated the fix and the tests.

On 11/2/05, James Y Knight <foom at fuhm.net> wrote:
>
> 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 at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20051103/e368c1ad/attachment.htm 


More information about the Twisted-Python mailing list