[Zope-dev] My sister was bit by an aq_base once

Jim Fulton jim@digicool.com
Fri, 30 Apr 1999 18:27:17 -0400


Mike Pelletier wrote:
> 
>     Ack!  This doesn't return anything:
> 
>         filter(lambda a, self=self: self in a.users, self.HGTasks())
> 
>     This returns what I am actually looking for:
> 
>         filter(lambda a, self=self.aq_base: self in a.users, self.HGTasks())
> 
>     Should I be having to use aq_base in a case like this?

Ugh. Whimper whimper. No, but you do.

This is due to a bug in the Acquisition module. It will be a bit painful
to fix too. :( The explanation is too complicated to go into here.

I'll put this on the to-do list. In the mean time, you'll have to use the
work-around that you figured out above.

>  HGTasks, BTW, is
> very simple and looks like this:
> 
>         return self.objectValues(Task.meta_type)
> 
>     On a related but stranger note, this works exactly like I expect it to:
> 
>         filter(lambda a, self=self: self==a.user, self.HGEntries())
> 
>     However it does not return anything that has been added to the database
> this session.  You have to restart for it to start returning a particular new
> item.  What is going on there?

By guess is that wrapped objects are being added to the objects in
memory and that they are unwrapped when loaded from the DB. The symptom
is probably due to the problem mentioned above.

Jim

--
Jim Fulton           mailto:jim@digicool.com   Python Powered!        
Technical Director   (888) 344-4332            http://www.python.org  
Digital Creations    http://www.digicool.com   http://www.zope.org    

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.