[Zope] zope objects in python : map() and filter()

ed colmar element@immersivearts.com
Mon, 13 Mar 2000 21:24:13 -0700


I have a few questions as to how to map zope objcts in python, and I'm
looking for help with this particular example.



I am trying to create a python method that will take one argument, a string
variable.  It will then find the people that match and return a list with
each of the person's data.



I have found two methods that come close to doing what I am after.  The
first one returns all of the people data, including all the variables, and
the second one filters out the people I don't want, but only returns the
ids.  I've tried switching aroung the map(None,self.ids) to
map(None,self.data) and I get typerrors from lambda.  

I don't fully understand how this is working or what the data looks like to
the interpreter, but I know I'm close

Can anyone help?



I've got ! these both work ! :

--------

    def peopleValues(self):
        """ return list of people's data  """
        return map(lambda x, p=self: x.__of__(p), self.data.map(self.ids))


    def remote_personlist(self, thisdjname):
        """ returns true with ids to remote people that match
        """
        rlist = map(None,self.ids)
        rlist = filter(lambda x,p=self : p.data[x].meta_type == 'This Kind
of Person', rlist)
        rlist = filter(lambda x,p=self,s=thispersonname :
p.data[x].clientpersonname == s, rlist)
        return rlist

-------


Thanks!

-ed-