[ZODB-Dev] Accessing Plone through ZEO back door?

Christian Robottom Reis kiko at async.com.br
Sun Aug 22 16:54:13 EDT 2004


On Sun, Aug 22, 2004 at 02:23:46AM -0400, Kirby Urner wrote:
> My original understanding was I could not attach an external Python
> interpreter to an already-running Zope instance *unless* I made both
> of these clients of zeo (some Medusa thing was an alternative). I'm
> thinking Zeo is what enables me to plug multiple clients into the same
> ZODB (in this case, Zope and an external Python script or shell,
> running another instance of Zope).

You're not attaching an external Python interpreter to Zope -- you're
attaching it to the ZODB, the database Zope is using to store some of
its data.

> According to this picture, if I try to run the above script, but Zeo
> is not in the picture, and Zope is already up in a browser, the script
> should fail, because Python will be blocked from sharing the same ZODB
> (I haven't tested this).

Yes, because only one python instance can access a FileStorage. However,
if you are using the ZEO, you can have as many clients access a
FileStorage that is hidden away behind a StorageServer.

> In order for my second client (my Python instance) to understand what
> my Zope client is doing in the ZODB, it needs to see the same
> products. Otherwise, even though it could access the same ZODB, it
> wouldn't be able to make much sense of the contents (e.g. the Plone
> stuff).

It needs the same Python modules, to be precise, but yes.

> My fantasy is: I do something through the web interface (e.g. add a
> new Document object to a folder), and right away I'm able to do
> something through the Python interpreter that lets me see this change
> in the ZODB. Alternatively, I could programmatically do something
> through the Python interpreter that would affect what a user sees
> through the web interface (I could even add another Document).

This is how it works, provided you understand that transactions are
isolated from each other (and connections need to be sync()ed to see
changes done by another client).

> Expert psychotherapy would be appreciated.

That's really stretching our realm of expertise; we're only supposed to
be doing simple lobotomies.

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331


More information about the ZODB-Dev mailing list