[Zope3-Users] Access to persistent Zope tables/classes in ZODB

Jim Fulton jim at zope.com
Fri Oct 27 07:41:48 EDT 2006


Rob J Goedman wrote:
> I'm wondering if there is an easy way to get to persistent objects 
> created in Zope and stored in ZODB
> from a python program outside Zope.

Yup.

> As an example, I would like to 
> iterate over created 'buddies' in buddydemo.

The easiest way is to use zopectl, which takes care of opening the
database(s) and loading the Zope configuration for you.

Interactively, use "zopectl debug".  This will give
you an interactive interpreter with an "app" variable set to
the top-level folder.

Use "zopectl run <your_script>" to run a script with the
same "app" variable set and ready for use.

Of course you can use the lower-level ZODB APIs to open the database
yourself.

Note that you'll want to use ZEO if you want to open the database while the
web application is running.

Jim


-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-users mailing list