[ZODB-Dev] ZODB 3.4 and Persistence
dangoor at gmail.com
Thu Jun 2 22:35:32 EDT 2005
On 6/2/05, Tim Peters <tim at zope.com> wrote:
> [Kevin Dangoor]
> > I'm working with the ZODB 3.4 beta, and I'm working on getting Catalog
> > running with it. I noticed that the _Persistence module is not being
> > built. Is this because ExtensionClass is not included and _Persistence
> > requires ExtensionClass?
> > Catalog has a couple of acquisition references that don't work properly
> > without ExtensionClass.
Regarding this particular problem, I found a solution. It's not
elegant (but, then, neither is using Catalog outside of Zope), but it
works. Basically I added this to Catalog:
aq_parent = DeadEnd()
where DeadEnd is an empty class that subclasses ExtensionClass.Base.
> Hmm. _Persistence.c should be removed from ZODB. Zope 2.8 has its own copy
> now, in its lib/python/Persistence/ directory. ExtensionClass is no longer
> part of ZODB (but is part of Zope 2.8; Zope3 doesn't use ExtensionClass
> either). If you try to import Persistence in "standalone" ZODB 3.3+, you
> should see this warning:
> UserWarning: Couldn't import the ExtensionClass-based base class
> There are two possibilities:
Yep, I saw that warning. I was puzzled by it, because I had
ExtensionClass available. It turns out that it was failing because
_Persistence itself was not available.
> If you do this from Zope 2.8, though, it picks up Zope 2.8's implementation,
> and doesn't give a warning. In short, ExtensionClass is a Zope2 thing, not
> a ZODB thing (nor even a Zope3 thing).
Yep, and there was much rejoicing! Sadly, I don't think Zope3 has
Catalog yet, does it?
Zope2 relies on ExtensionClass for the __of__ mechanism to enable
Acquisition. I realize the implicit acquisition is currently viewed as
less than ideal, but it seems like Zope3 would still need __of__. That
must be coming from somewhere else.
> I don't know how hard it may be to do #2 above ("install the ExtensionClass
> package separately"), but dimly recall that some people said they had
> problems trying to do so (ZODB 3.3 is over a year old now, and my memory
> doesn't go back much beyond lunch <0.9 wink>).
Actually, ExtensionClass was very easy. As of now, I have a running,
but poorly tested, standalone Catalog package. (With a distutils setup
and everything :) Once I've kicked it around a bit more, I'm going to
release it, since I haven't seen anyone else actually package it up.
More information about the ZODB-Dev