[Zope] looping through objectValues, how to get methods?
Chris McDonough
chrism@digicool.com
Wed, 19 Jul 2000 11:07:56 -0400
days_mixing = getattr(i, 'mixing_for')
a = days_mixing()
> -----Original Message-----
> From: ed colmar [mailto:element@immersivearts.com]
> Sent: Wednesday, July 19, 2000 11:09 AM
> To: zope@zope.org
> Subject: [Zope] looping through objectValues, how to get methods?
>
>
> I have a method that looks through "objectValues". Using
> "hasattr" and
> "getattr" I can see the variables contained in the object.
>
> How do I get the values generated from an object's method in a similar
> fashion?
>
> For example:
>
> def dj_experince_statistics(self):
> """
>
> """
> rlist = self.People.objectValues('SRPersonPost')
> newbcount=0
> for i in rlist:
> if hasattr(i, 'validated'): #get validated variable
> if hasattr(i, 'djname'): #get djname variable
> if hasattr(i, 'mixing_for()'): #try to get
> mixing_for() method
> days_mixing=getattr(i,'mixing_for()')
> if days_mixing < 730.0:
> newbcount=newbcount+1
> return newbcount
>
>
> BTW this does not work.
>
> Thanks for any suggestions!
>
> -ed-
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> 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 )
>