[Zope] Double backslashes in IE
chris at d-designz.co.nz
Wed Feb 18 18:49:11 EST 2004
Perhaps the problem is that IE returns the entire file location rather
than just the file name.
findslash = filename.rfind('\\')
if findslash != -1:
filename = filename[findslash+1:]
Horak, Karl wrote:
>Thanks for the suggestion. Unfortunately, it doesn't seem to solve the
>underlying problem. Still getting a key error for <dtml-var
>expr="_.getitem(stripDs(file.filename))"> where stripDs is a script
>that returns string.replace(x, '\\\\', '\\'). Perhaps the Zope error
>is escaping the \'s in the filename, thus creating the \\'s that I see.
>BTW, on my office computer the Zope error page displays the key error
>the message C:\CSF\BUS581\581F203H1BJS.doc (no single quotes, no double
>So I'm back to the core problem of why IE has trouble with <dtml-var
>expr="_.getitem(file.filename)"> when all the other browsers don't.
>From: Chris Beaven [mailto:chris at d-designz.co.nz]
>Sent: Wednesday, February 18, 2004 4:09 PM
>To: Horak, Karl
>Subject: Re: [Zope] Double backslashes in IE
>Karl, even with raw strings the last character can not be a \.
>string.replace(x, '\\\\', '\\') should work better
>Horak, Karl wrote:
>>Following up on my problem with getting errors in the expression
>>_.getitem(file.filename) when using IE, I've learned that IE "sees" the
>>filename as something like 'C:\\CSF\\BUS581\\581F203H1BJS.doc'. The
>>backslashes are making it an invalid filename.
>>I've put on my Python thinking cap, figuring I can write a script that
>>care of that. But string.replace(x, r"\\", r"\") doesn't work. The
>>single slash escapes the final double quote and gives an error.
More information about the Zope