Hi Dan, First, sincere apologies for the long delay in replying, I'm afraid your mail got buried in my inbox (been busier than usual lately and apparently my email discipline has slipped :(). We're not usually this unresponsive!
It's been a while since I poked around comment/uncomment/sed, but if I understand your issue correctly, it's mostly just that we thought to escape sed's before/after args, but not the limit arg. Looking at the function now, it seems to me the most obvious/best solution is to apply that escaping to the limit argument as well. Would that solve the problem you're having? Best, Jeff On Thu, Oct 28, 2010 at 4:46 PM, Dan Craig <d...@hivefire.com> wrote: > Hello all, > > I'm new to Fabric, but have enjoyed learning it and look forward to using it > for automating deployments. Thanks for writing it. > > In the process, I got hung up on the behavior of contrib.files.comment and > uncomment. I want to be able to uncomment and then later recomment a line > from an Apache conf file. The lines themselves contain regular expressions, > so I passed them through re.escape() first before uncomment()/comment(). > This works just fine on uncomment(), but fails on comment(). I traced the > cause of this down contrib.files.sed's escaping of the before and after > arguments, but not the limit. In uncomment(), the line to uncomment is > passed to sed as the limit, and thus not escaped, but in comment, the line > is passed to sed as the before, which is escaped. > > My workaround is to call uncomment like normal:: > > uncomment(myfilename, re.escape("MyReContainingLine")) > > but call comment like so:: > > comment(myfilename, re.escape("MyReContainingLine").replace(r"\/", "/")) > > This works, but seems wrong. I'd expect uncomment and comment to be called > in the same way. OTOH, the escaping in sed is a nice convenience. Thought > I'd throw this out there in case it might be worth addressing. > > Regards, > Dan Craig > > _______________________________________________ > Fab-user mailing list > Fab-user@nongnu.org > http://lists.nongnu.org/mailman/listinfo/fab-user > > -- Jeff Forcier Unix sysadmin; Python/Ruby developer http://bitprophet.org _______________________________________________ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user