[Zope] Learning Python Syntax for Zope Objects and DTML Operations

Dan Shafer pydan@danshafer.com
Sun, 05 May 2002 14:52:27 -0700


Thanks for the response, Dieter.

At 10:14 PM 5/5/2002 +0200, Dieter Maurer wrote:
>Dan Shafer writes:
>  > ....
>  > If I have a collection of DTML Methods in
>  > ....
>  > But I can't figure out how to reference the objects, let
>  > alone iterate over them.
>Please read about "Bindings" in the Python Script documentation.
>This will tell you how to access the objects.

This was the missing piece for me. Is there any *specific* Python Script 
documentation you have in mind? I will go rummaging about and see what I 
can locate but if you have a specific pointer, that would be helpful and 
time-saving.

>Please look into the Python Language Reference (or an elementary
>Python book) for "for" to learn about iteration in Python.

I knew I had to use a "for" construct, the problem was creating the rest of 
the line, as you have done here. Is this syntax *always* consistent? I.e., 
is it always context.someDTMLfunction(['list of', 'string arguments'])?

Thanks again. I'll get this soon, I'm sure!

>Your solution will somehow look like:
>
>      for o in context.objectValues(['DTML Method']):
>        # do something with your object
>
>
>Dieter