[ZODB-Dev] Re: Article on ZODB Programming

Jim Fulton jim@digicool.com
Mon, 18 Jun 2001 18:41:09 -0400


Michel Pelletier wrote:
> 
> On Mon, 18 Jun 2001 aahz@panix.com wrote:
> 
> > > I've written the first in a series of articles on the Zope Object
> > > Database (ZODB).  These articles show you how you can use ZODB in your
> > > python programs to save your objects in a database transparently.
> > >
> > > This article does not require any use of Zope, but installing Zope is the
> > > easiest way to get ZODB.  If your interested in an interesting,
> > > object-oriented alternative to relational database, you should check this
> > > out:
> > >
> > > http://www.zope.org/Documentation/Articles/ZODB1
> >
> > Looks pretty good based on the bit I've seen.  I don't have ZODB
> > installed, so I can't try it out, but I do have a question.  Several
> > times, you use the following command
> >
> >       >>> get_transaction().commit()
> >
> > but unless you're playing funky games, I don't see how get_transaction()
> > ends up in the interpreter global namespace.
> 
> I don't know the why of it, but the function get_transaction is stuffed
> into the global namespace by ZODB when it is imported.  I'm cc:ing the
> zodb-dev list to see if anyone knows why.

I had the goal of avoiding dependence of applications that wanted
to use transactions from any particular database version. Transaction
management was implemented by BoboPOS, and is now implemented by ZODB.
I chose __builtins__ as a way to offer some indirection.

In the future, I plan to break Transacion out as a separate package.
In that case, applications would call Transaction.get_transaction.
I'd still probably hack __builtins__ for backward compatability.

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