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

Jeff Rush Jeff Rush" <jrush@timecastle.net
Mon, 01 Nov 99 07:36:19 -0500


On Fri, 29 Oct 1999 20:01:15 +0200, Martijn Pieters wrote:

>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">
>>
><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.

Thanks Martijn -- that works fine!  At the risk of sounding dumb, I don't
quite understand it -- why does the 0th array element within object
'site.css' contain a pointer to the object itself and how would a Zope
developer know this?  I've been thru the Zope source and haven't
come upon that particular construct.

And naturally, what resides at other offsets?  Oleg Broytmann wrote that
doing the say with offset 1 would result in a call to the object ???

-Jeff Rush