[ZODB-Dev] [Fixed?] _p_jar magic stopped working

Jim Fulton jim@zope.com
Sat, 10 Aug 2002 08:10:42 -0400


Ross Boylan wrote:
> I think I've fixed this.  Can anyone confirm my new approach is good?

Sorry I didn't reply to earlier note. I'm on vacation and was hoping someone
elese would.


> The big problem was that the db no longer provides dictionary-like
> semantics for named objects. 

It never did (in ZODB 3). Maybe this was way back in the days
of BoboPOS 2, which didn't support multiple connections. I bet that
explains the misunderstanding.

 > Instead I use _p_jar.root() to get what
> I hope is the same thing.

Right. You can never get data directly from a database. You must open a
connection first. To get the mapping object containing the root objects,
you must use the root method.

> The smaller problem with my old code was that db stopped being an
> instance variable and became a method. 

Your code must be *very* old, as in pre ZODB 3.


 > So _p_jar.db() gets the db.
> It was at that point I discovered I didn't want the db any more.
> 
> Looking in the change logs it appears the last big db change was at
> Zope 2.0, and I thought my earlier work postdated that.  Have there
> been more recent changes, or have I just been away longer than I
> thought?

You've been away a looong time. Should I call you Rip? ;)

...

> P.S. The docs say _p_jar is None if the object has not been saved,

Right.

 > but
> it appears to be a valid Connection even with the object created in
> the same transaction.

I think you are mistaken.

Jim

-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org