[Zope] How to insert variable from expression?

DA Loeffler David.Loeffler@bristol.ac.uk
Fri, 12 Jul 2002 15:46:02 +0100 (BST)


Sorry, I am an idiot. getattr takes 2 arguments, and id() is a method. 
Try something like

<dtml-var "_.getattr(this().aq_parent, id() + '.gif')">

This does work, I've tested it.

David


On Fri, 12 Jul 2002, DA Loeffler wrote:

> Perhaps <dtml-var "_.getattr(id+'.gif')">?
> 
> 
> On Fri, 12 Jul 2002, Jaroslav Lukesh wrote:
> 
> > Hi all,
> > 
> > I have file#(DTML Document), that have image with same name, but with
> > extension for image
> > type. 
> > 
> > file1
> > file1.gif
> > file2
> > file3
> > file3.gif
> > 
> > So what Can I do insert image with that composite filename? And if
> > missing, insert nothing.
> > 
> > <dtml-in.....(DTML Document)...>
> > 	.......
> > 	<dtml-var expr="_['id'] + '.gif'" missing> ???
> > </dtml-in>
> > 
> > It insert filename.gif only,no picture. render(_['id'] + '.gif') does not
> > work, wrong syntax?
> > 
> > I was read "Basic COncepts" (aka book3) chapter 4.2.1 (Computed Object
> > access), example 3.5 and _[prefix + 'suffix'] does not work :(
> > 
> > Many thanks
> > 
> >              Jaroslav Lukesh
> > 
> > 
> > 
> > _______________________________________________
> > Zope maillist  -  Zope@zope.org
> > http://lists.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists - 
> >  http://lists.zope.org/mailman/listinfo/zope-announce
> >  http://lists.zope.org/mailman/listinfo/zope-dev )
> > 
> > 
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
> 
>