[Zope] Problems with sequence-item

Curtis Maloney curtis@cardgate.net
Mon, 23 Oct 2000 09:41:56 +1100


On Mon, 23 Oct 2000, Taco Scargo wrote:
> I get errors when sequence-item is being called to list the contents of a
> folder
>
> E.g.
> <dtml-in "(1,2,3)" reverse>
> <dtml-var sequence-item>
> </dtml-in>
>
> correctly outputs 3 2 1
>
> When I do
>
> <dtml-in "folder.objectValues()">
> <dtml-var id>
> </dtml-in>
>
> it correctly outputs all ids in the folder.
>
> But
>
> <dtml-in "folder.objectValues()">
> <dtml-var sequence-item>
> </dtml-in>
>
> will fail with an error
> Error Type: AttributeError
> Error Value: __call__
>
> What am I doing wrong ?
>

Your problem appears to be in the using of objectValues().  This returns the 
actual objects.  So, in the second loop (<dtml-var id>)  you are referencing 
the 'id' member of each object.  Nothing wrong there.

However, in the third loop (<dtml-var sequence-item>) you are trying to 
render the object itself.  This will 'call' each object, which some of them 
(obviously) object to. (No pun intended)

If you want to render all the DTML Documents and DTML Methods in the folder , 
try something like:

<dtml-in "folder.objectValues(['DTML Document', 'DTML Method'])">
  <dtml-var sequence-item>
</dtml-in>

but this could get very messy with a large folder. (o8

> Thanks,
>
> Taco Scargo
>

Have a better one,
	Curtis Maloney