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:] return filename 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 (Python) that returns string.replace(x, '\\\\', '\\'). Perhaps the Zope error page 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 with the message C:\CSF\BUS581\581F203H1BJS.doc (no single quotes, no double slashes).
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.
-----Original Message----- From: Chris Beaven [mailto:chris@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 double backslashes are making it an invalid filename.
I've put on my Python thinking cap, figuring I can write a script that takes care of that. But string.replace(x, r"\\", r"\") doesn't work. The
raw
single slash escapes the final double quote and gives an error.
Any suggestions?