[Zope] Class - Object relationship

Chris McDonough chrism@zope.com
Sat, 08 Dec 2001 17:21:42 -0500


 > I would like to know how an object/instance "knows" what class it is 
built
 > from.
 >

A persistent object in the ZODB knows what class its built from because 
it stores a fully-qualified name of the class, which includes the module 
name that the class lives in.  So when a ZODB object is "woken up", the 
ZODB grabs the class definition by essentially doing an "import" of the 
class, e.g.

import Products.Foo.Bar.Fudge

If a class by this name can be found, it is used.

> Where can I read up on this?

The developer's guide on Zope.org (persistence chapter) might have some 
data on this, but it's largely an implementation detail (albeit an 
important one ;-)
-- 
Chris McDonough                    Zope Corporation
http://www.zope.org             http://www.zope.com
"Killing hundreds of birds with thousands of stones"