[Zope] How to access ZODB from python code

Dieter Maurer dieter@handshake.de
Tue, 25 Mar 2003 20:43:27 +0100


Gabriel Genellina wrote at 2003-3-24 19:25 -0300:
 > I want to get access to some Zope objects stored in ZODB, from *outside* of 
 > any other Zope object (so I dont have anything to call getPhysicalRoot() or 
 > restrictedTraverse() on) but from *inside* python code running in the Zope 
 > process.
 > This doesnt work:
 > 
 >          from Zope import Zope
 >          app = Zope.app()
 >          app.restrictedTraverse(...)
 > 
 > The Zope server freezes, I guess there is a deadlock there.

Does this already happens for the first time?

It would be understandable when it happes after some successes
unless you close the ZODB connection when you are finished:

       Zope.app() opens a ZODB connection which must be closed
       later. There is a connection pool (of 7 connections, by default).
       The application blocks when there are no free connections.


Dieter