[Zope] sifting through python sub-objects

ed colmar element@immersivearts.com
Mon, 19 Jun 2000 19:36:57 -0600


I've succesfully gotten the catalog to work (thanks everyone!), but in
doing so, I've created a problem.  Squishdot uses this code like this in
order to add an item:

        id=self.createId()    # make a datestamp id
        msg=PromoterPost(id,title) 
        msg=msg.__of__(self)  #  ???
        self.setItem(id,msg)  #  set the item

This code is incompatible with the catalog.  As far as I can tell because
The catalog likes to see id's as strings, but I don't think the object gets
completely added to the zope fs either.  After changing the code that does
the adding to the zope fs everything related to the catalog seems good.
Here's the new code:

        ob=PromoterPost(id,title)
        ob.id = id
        ob.title = title

        self._setObject(id,ob)
        self.getCatalog().catalog_object(ob,id)

So here's the problem, the methods that squishdot uses to locate
sub-objects relies on a BTree() type method, called "data", and is used by
a few methods like this:

    def objectValues(self):
        """ return list of subobjects """
        return map(lambda x, p=self: x.__of__(p), self.data.map(self.ids))
 or 

    def is_local_user(self, thisuser):
        """ returns true with ID if user is a local user
            based on rev_id_list in squishdot
        """
        rlist = map(None,self.ids)
        rlist = filter(lambda x,p=self : p.data[x].validated, rlist)
        rlist = filter(lambda x,p=self : p.data[x].meta_type ==
'SRPersonPost', rlist)
        rlist = filter(lambda x,p=self,s=thisuser : p.data[x].title == s,
rlist)
        return rlist

	Neither return any results, becuase in the new code, the data object is
not getting updated.  Do I need to keep a record of all the ids like
squishdot does, or can I leave that up to zope?

	It seems like there should be an easier way than "self.data" to do this...  

	Any ideas?