[Zope-dev] Establishing root objects in ZODB under Zope
Ross Boylan
RossBoylan@stanfordalumni.org
Wed, 23 Jan 2002 21:37:17 -0800
I have some data that will not naturally live as an item in a folder. If
I'm using Zope, how do I establish a root for it? The ZODB docs talk about
how to handle a free-standing database, but I don't see info about how to
use the one that Zope has already set up. I recall there's some way to get
a handle to the open database, but I don't recall exactly what. Can
anybody help me out?
If I use a class variable, will that be persisted automatically, e.g.
class MyManager(Persistence.Persistent):
MyClassVariable = SomePersistentClass()
.....
? (Actually, I'm not sure if it matters whether MyManager is a subclass of
Persistent).
Or, if it is not automatically persistent, is there anything I can do to
make it persistent so that it will obey the transaction boundaries coming
from web requests?
Final question, which is distinct from the root objects issue: if I use
Zope's Persistent List, will that avoid the problem of faulting in the
whole list if I don't need it? I am looking for a good way to keep a
record of transactions. ZODB's raw transaction recording is probably not
quite right since it has the wrong granularity, it mixes a lot of unrelated
transactions (it's only some I want), and I think it can get zapped if I do
various database compactions and cleanups.
Thanks.