[Zope] DTML-WITH Problem

Oliver Bleutgen Oliver Bleutgen <myzope@gmx.net>
Mon, 17 Sep 2001 21:01:22 +0200


> ----------
> <dtml-call expr="REQUEST.set ('working_folder', gallery_id)">
>   <dtml-with expr="galleries.restrictedTraverse([working_folder])">
>     <dtml-in expr="objectValues('Image')" sort=bobobase_modification_time
> reverse>
>          <dtml-var title><BR>
>    </dtml-in>
>   </dtml-with>
> ------------

One remark,
if the above is all you really want to do, you could also do:

<dtml-in expr="galleries[gallery_id].objectValues('Image')" sort=bobobase_modification_time reverse>
<dtml-var title>
</dtml-in>

You are not really traversing here - well, just one folder - 
so restrictedTraverse is overkill, IMO.

> Maybe this will provide help to someone else in the future

> Now, one last question (Well, maybe not THE LAST ;-) ): Where the heck can
> one find stuff like that? I mean where can I learn that?


ZMI's online help, esp. the API documentation (though it has it's gaps),
this would have told you enough about restrictedTraverse.

> Is that Python already and I should finally open up my Python book?

IMO one can agree it's python, or disagree. I can assure you that
knowing python definitly helps. If you get enough knowledge of python 
(not too much needed) you can start glancing through zope's source - 
and combining that with the API-doc you get slowly a feeling of how 
zope itself is structured, where to look ...
The third chapter of Dieter's book helps me a lot to get an idea
about the why's and how's. See also Dieter's docfinder product.

Also very nice
http://www.zope.org/Members/mcdonc/HowTos/gainenlightenment 

and the ZDG
http://www.zope.org/Documentation/ZDG/

As a beginner one encounters some annoyances and hard to grasp 
difficulties, but as the time goes by it gets better and better.
And not because one gets accustomed to them and avoids them, but 
because one sees more and more of the "big picture" and many things
suddenly make sense.

Note to others: I explictly exclude sequence-* and orphan here ;->.

cheers,
oliver