[ZODB-Dev] ZODB3.3.0b1 and ExtensionClass?

Jim Fulton jim at zope.com
Fri Jun 25 14:11:20 EDT 2004


Some notes:

- If you don't need features of EC beyond what new-style classes
   give you, then, by all means, move away from it.
   If you do this, you may find:

    http://docs.python.org/ext/dnt-basics.html

   helpful. It's a tutorial I wrote while learning how to write
   new-style classes.  (I was lucky enough to have help from
   Guido and Tim while learning. IOW, I had an advantage that
   I thought I'd better share. :)

- There is an ExtensionClass-based persistence in Zope 2's
   lib/python/Persistence package.  Frankly, I don't remember
   how different this is from the old Persistence base class.
   Certainly subclassing new-style classes in C is very different
   from (and cleaner than) subclassing old ECs was. This is
   one of the reasons I never even considered making BTrees
   new-style extension classes.

- The new ExtensionClass.h in Zope2's lib/python/ExtentionClass
   provides a good bit of backward compatability. I was able to port
   the existing C ExtensionClass classes to new-style ExtensionClasses
   with little or no change.

- Zope 2 will use new-style ExtensionClas indefinately.

Sorry, but I probably could have been a lot more help with this
almost a year ago when I wrote new-style ExtensionClass.  But
you're better off moving to new-style classes if you can anyway.

Jim



Christian Robottom Reis wrote:
> I've started to get IndexedCatalog working with ZODB3.3. So far, it's
> been quite miserable, however. The reason is that IndexedCatalog's base
> class uses ExtensionClasses, and I've been unable to get ExtensionClass
> set up at all with 3.3.
> 
> Being unable to find an ExtensionClass package, I pulled the code from
> svn head, compiled and installed it. Now the tricky part after this is
> getting Persistence to compile, because it wasn't by default -- I gave up
> trying to nudge zpkgtool to compile it for me and ended up doing it
> manually for the heck of it.
> 
> However, after getting EC, ZODB-3.3 and the Persistence bits installed
> into a local directory, starting up the imports gets me as far as
> 
>       File
>       "/home/kiko/Z33/lib/python2.3/site-packages/Persistence/__init__.py",
>       line 48, in ?
>           from Persistence.mapping import PersistentMapping
>       ImportError: dynamic module does not define init function
>       (initPersistence)
> 
> Which indeed from the source code does not exist; though we do have an
> init_Persistence function. I think that some sort of skew is happening
> here, but I can't exactly explicit what not having paid attention to
> what went on over these past months wrt ExtensionClass and ZODB-3.3.
> 
> So I'm at a point where I want to understand my alternatives.
> 
>     a) Is ZODB-3.3 + ExtensionClass broken right now, or do I need to
>        learn the magical incantations that will make it fly?
> 
>        Is there an ExtensionClass tarball I should be using?
> 
>        I assume that some Zope packages use EC and because of that there
>        is some way it should work, but I can't see how.
> 
>     b) Is this at all useful for me, however? Is ExtensionClass still
>        code-compatible (at the C level) to my extension, or am I better
>        off rewriting the bits that depend on EC to stop doing so?
> 
> I'm leaning towards b) after spending a morning chasing compile and
> import errors all over the place. Anybody had similar problems moving
> on to 3.3?
> 
> Take care,
> --
> Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331
> _______________________________________________
> For more information about ZODB, see the ZODB Wiki:
> http://www.zope.org/Wikis/ZODB/
> 
> ZODB-Dev mailing list  -  ZODB-Dev at zope.org
> http://mail.zope.org/mailman/listinfo/zodb-dev


-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the ZODB-Dev mailing list