[Zope] Obtaining URL of Object w/Non-Var Name

Martijn Pieters mj@antraciet.nl
Fri, 29 Oct 1999 20:01:15 +0200


At 19:19 29-10-99 , Jeff Rush wrote:
>Alright, what's the trick to be able to retrieve the URL of a Zope object
>via DTML whose id has blanks or punctuation in it?  For example,
>in a normally-named object called 'site_css', I'd do:
>
>Ex. 1
>     <LINK REL=stylesheet HREF=<dtml-var "site_css.absolute_url()"> 
> TYPE="text/css">
>
>But if the object is named 'site.css', I can use it w/o another layer/call 
>or escape code.
>I tried the following (and a lot of others) and the _[] expression is 
>returning a string,
>which then fails when it lacks a 'absolute_url' attribute:
>
>Ex. 2
>     <LINK REL=stylesheet HREF=<dtml-var "_['site.css'].absolute_url()"> 
> TYPE="text/css">

<LINK REL=stylesheet HREF="<dtml-var "_.getitem('site.css', 
0).absolute_url()">" TYPE="text/css">

This retrieves the object from the namespace without calling it.

--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| T: +31 35 7502100 F: +31 35 7502111
| mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
---------------------------------------------