[Zope] How do I get the value of an object in python???

Dieter Maurer dieter at handshake.de
Mon Aug 25 23:21:17 EDT 2003


Bill Hewitt wrote at 2003-8-24 09:03 -0700:
 > ...
 > > ## Look for Day Year (ie - Monday 2003)
 > > for i in container.StyleBook.objectValues('Style Sheet') :
 > >       print container.StyleBook.loadStyle(title=i.title, 
 > >                                           styletype=i.styletype,
 > >                                           bodycolor=i.bodycolor
 > >                                         )
 > >       return printed
 >  
 > and it runs fine against loadStyle - a DTML method I wrote to return a formatted CSS stylesheet.....
 > 
 > 
 > But what I would like to do is use loadStyle in the context of i - in other words, use i's attributes as properties
 > to loadStyle WITHOUT having to declare them all as arguments to loadStyle.

Almost surely, the following will work:

       ... loadStyle(i,container.REQUEST)
       ...

The full solution will be to bind the DTML namespace in your Python
Script (usually called '_') and use

       ... loadStyle(i,_)
       ...

This will pass the DTML namespace from a DTML object
through the Python Script to "loadStyle" (in case you need this; which
is probably not the case).

Please read "Calling DTML objects" in 

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



Dieter



More information about the Zope mailing list