[Zope] Python and Zope Question

Kevin Dangoor kid@kendermedia.com
Thu, 1 Jun 2000 19:32:32 -0400


----- Original Message -----
From: "Scott Burton" <scott@launchpoint.net>
To: <zope@zope.org>
Sent: Thursday, June 01, 2000 6:58 PM
Subject: [Zope] Python and Zope Question


> Major newbie here. I am wanting to create a python method that
> iterates over items in a folder object in Zope. I am struggling with
> how to access objects in the ZODB in python. Here's the script in the
> simplest form.
> for x in folderObject :
>   return x

You need to put self as a parameter to your method and then do
for x in self.folderObject.objectValues():
  return x

You use "self" to get at all of the stuff in the ZODB. Note that self is
bound to the container of the PythonMethod. So, if you want the PM to work
on the current folder, you can just do:

for x in self.objectValues():
  return x

(Of course, this will just return the first value, but that was your example
:)

Kevin