Re: backslashes get stripped from $ signs

will kahn-greene <[email protected]> Sun, 09 Jan 2011 09:49:03 -0500
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
I talked with Dieter about this on IRC and we worked out a fix which was
just pushed.


On 01/09/2011 06:36 AM, Dieter Plaetinck wrote:
> On Sat, 08 Jan 2011 17:26:43 -0500
> will kahn-greene <[email protected]> wrote:
> 
>> On 01/08/2011 04:56 PM, Dieter Plaetinck wrote:
>>> On Mon, 27 Dec 2010 11:46:48 +0100
>>> Dieter Plaetinck <dieter-7FYLOmueu/[email protected]> wrote:
>>>> +        var_dict['body'] = var_dict['body'].replace(r'\$', '\\\$')
>>>>      replacer = Replacer(request, encoding, var_dict)
>>>>      return _VAR_REGEXP.sub(replacer.replace, template)
>>>>  
>>>>
>>>> this kind of works, except that for some reason i need 3
>>>> backslashes in the replacement, and this will also change '$' into
>>>> '\$', which i don't want, obviously. changing the first param to
>>>> '\\$' doesn't help either.  I'm not sure what the 'r' is for, but
>>>> I saw it in BlosxomRenderer:render_template(), and using it
>>>> doesn't seem to change anything.
>>>
>>> anyone an idea?  on a python commandline shell I can just do:
>>> str.replace('\$', '\\$') 
>>> but I have no idea why I can't get it to work in Pyblosxom/tools.py
>>
>> The line you're doing on the python repl is different than the one
>> you're doing in your patch.
> 
> I know... I can't get it to work with only two slashes, like I said
> below the patch. (with two slashes it doesn't change anything, maybe
> I'm just looking at the wrong part of the code)
> 
> Dieter

------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl