----- Original Message -----
From: "Scott Burton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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


_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to