Hi, I have a ZPT which iterates through folders and files to produce a directory listing. However, the links to these files need to be urlencoded, in case the file names contain spaces (or other "odd" characters). I have tried the code given below, but urlencode isn't recognised ("NameError: global name 'urlencode' is not defined" : <--- snip ---> <a href="id" tal:attributes="href python:urlencode(item.getId())"> <!--- snip ---> Any help would be much appreciated, Thanks, Dominic
Dominic Hiles wrote at 2003-5-30 16:00 +0100:
... <--- snip ---> <a href="id" tal:attributes="href python:urlencode(item.getId())"> <!--- snip --->
Try: ... tal:define=" std modules/Products.PythonScripts.standard; url_quote nocall: std/url_quote; " tal:attributes=" href python:url_quote(item.getId()); " ... "standard" contains more helpful definitions.... Dieter
Thanks Dieter - that sorted it out perfectly. Cheers, Dominic --On 31 May 2003 11:23 +0200 Dieter Maurer <dieter@handshake.de> wrote:
Try: ... tal:define=" std modules/Products.PythonScripts.standard; url_quote nocall: std/url_quote; " tal:attributes=" href python:url_quote(item.getId()); " ...
"standard" contains more helpful definitions....
Dieter
participants (2)
-
Dieter Maurer -
Dominic Hiles