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

Dieter Maurer dieter@handshake.de
Mon, 6 May 2002 18:11:56 +0200


Dan Shafer writes:
 > ...
 > >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.
What about the Zope Book or

  <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>


 > >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'])?
It is *never* "someDTMLfunction([...])".

You need to split things into different subtasks. Otherwise, you will loose:

Again:

  *  you access objects (and their attributes) via the bindings

  *  you interate over sequences with: "for XXXX in SEQUECNE"

  *  you call methods according to their API (see embedded online
     help -> Zope Help -> API reference)

     Especially, you do not call DTML objects with a list
     of strings as single parameter (more in
     "calling DTML objects" in the above reference.


Dieter