[Zope] Calling objects with arguments in a sequence

Tres Seaver tseaver@digicool.com
Wed, 27 Sep 2000 17:28:46 -0400


seb <sebbacon@email.com> wrote:
> 
> I'm using the Photo product, instances of which I can call, with
> arguments, like this:
> 
>         <dtml-var "my_photo(display='thumbnail')">
> 
> However, I can't work out how to pass arguments to each sequence item
> when iterating over a sequence.
> 
> For example, I've tried:
> 
>         <dtml-in objectValues(['Photo'])">
>                 <dtml-var "_['sequence-item'](display='thumbnail')">
>         </dtml-in>
> 
> (..not that I expect that to work :)
> 
> And I get
> 
> Error Type: TypeError
> Error Value: call of non-function (type string)
> 
> I've tried various combinations of ways of calling the sequence-item,
> but they all return the same error.  Could anyone suggest how I should
> do this?  Thanks in advance...

You were very close -- the trick here is that 'objectValues' returns
real objects, not IDs.  Try this (untested)::

  <dtml-in "objectValues( [ 'Photo' ] )">
   <dtml-let photo=sequence-item> <!-- alias so we can use in expr! -->
    <dtml-var "photo( display='thumbnail' )">
   </dtml-let>
  </dtml-in>

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org