[Baypiggies] regex puzzle
Aaron Maxwell
amax at redsymbol.net
Wed Mar 12 17:50:15 CET 2008
Yup, that's it. For the record, I just added the line
{{{
cmdline = cmdline.replace('\\', '\\\\')
}}}
to the onecmd() method in our subclass of Cmd, like so:
{{{
def onecmd(self, cmdline):
cmdline = cmdline.replace('\\', '\\\\')
# do any other special handling,
# ultimately pass off to Cmd.onecmd(cmdline)
}}}
Thanks Matt. The trac example you pointed to is an exact fit.
-Aaron
On Tuesday 11 March 2008 19:05:57 Matt Good wrote:
> On Mar 11, 2008, at 10:47 AM, Aaron Maxwell wrote:
> I think what you're seeing is due to how the cmd module parses the
> command input. It tries to behave like a Unix shell and treats \ as
> an escape character as described here:
> http://trac.edgewall.org/ticket/994
>
> It's easy to workaround this by overriding Cmd.onecmd and replacing
> the backslashes:
> http://trac.edgewall.org/changeset/3513/trunk/trac/scripts/admin.py
>
> -- Matt
--
Aaron Maxwell
http://redsymbol.net
More information about the Baypiggies
mailing list