[Zope] help with zodb

Jeff K. Hoffman jeff.hoffman@goingv.com
Tue, 29 Feb 2000 18:07:32 -0500 (EST)


On Tue, 29 Feb 2000, Garrett G. Hodgson wrote:

> i can run this by hand, and it works fine.
> so i create an External Method that points to GetPeople().
> when i reference it in a DTML document, i get:
> 
>    Could not lock the database file. There must be another process
>    that has opened the file. 
> 
> and a lengthy traceback:

[snip]

Only one process can access a ZODB at a time. You have two. The first is
Zope, and the second is the external method.

You don't need to re-open the ZODB inside your external method. By the
time you've gotten there, Zope already has it open.

> i've gotten this same message sometime when running by hand, typically
> when i called two routines in a row that each instantiated a ZODB.DB.
> so it appears that this has something to do with the DB object not being
> destroyed.

Yes and no. Yes when you run it by hand and the second routine fails. No
when you run it in Zope. You should NEVER have to worry about opening or
closing the ZODB from inside a DTML/External/Python Method.

> but i don't know how to make this work.  i've sanned the archives, and
> seen no similar complaint, so i assume others don't have this problem.
> 
> any ideas why i do?

AFAIK, you simply need to create an instance of your object and set it as
an attribute of another persistent object. The persistence should happen
automatically.

Someone correct me if I'm wrong.

--Jeff

---
Jeff K. Hoffman                                         704.849.0731 x108
Chief Technology Officer                                mailto:jeff@goingv.com
Going Virtual, L.L.C.                                   http://www.goingv.com/