[ZODB-Dev] ZODB 3.4 and Persistence

Tim Peters tim at zope.com
Thu Jun 2 15:23:03 EDT 2005


[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.

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:

    1. You don't care about ExtensionClass. You are importing
       Persistence because that's what you imported in the past.
       In this case, you should really use the persistent package
       instead:

          >>> from persistent import Persistent
          >>> from persistent.list import PersistentList
          >>> from persistent.mapping import PersistentMapping

    2. You want your classes to be ExtensionClasses. In this case,
       you need to install the ExtensionClass package
       separately. ExtensionClass is no-longer included with ZODB3.

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).

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>).



More information about the ZODB-Dev mailing list