[Zope-dev] Why missing connection._storage.load?

Loren Stafford lstaffor@dynalogic.com
Sun, 27 Feb 2000 19:31:18 -0800


My product's initialize(context) procedure creates a ZCatalog if that
catalog doesn't already exist. I've defined an additional method
armed_event() for the Catalog object. Later, the same product _init_.py
module calls armed_event() (OK -- it's called from a thread spawned by
initialize(context)).

When the catalog is created in the same product load process, the call to
the catalog method armed_event() yields this output from pdb:

  > C:/Zope214\lib\python\Products\ZScheduler\ZSchedule.py(47)armed_event()

...which is what I would expect.

However, when the catalog already exists (from a previous product load),
the call to the catalog method yields this output:

  > C:\Zope214\lib\python\ZODB\Connection.py(386)setstate()

I didn't write any setstate methods, so I presume this is extension class or
persistence voodoo. If so, the fact that pdb doesn't show how it got to
setstate must be due to the fact that that logic is written in C. Somewhere,
somehow, (perhaps via an inherited __setstate__ method) Zope has figured out
that the catalog object has to be loaded from the ZOSB before it can
proceed, and calls on Connection.py\setstate to help do so. Right, so far?

OK, tracing along in setstate(), we get to this statement and exception:

 > C:\Zope214\lib\python\ZODB\Connection.py(391)setstate()
 -> p, serial = self._storage.load(oid, self._version)
 (Pdb) s
 AttributeError: "'None' objec...ribute 'load'"
 > C:\Zope214\lib\python\ZODB\Connection.py(391)setstate()
 -> p, serial = self._storage.load(oid, self._version)
 (Pdb)

OOps! This connection's storage object has no load method. How can that
happen? Because pdb isn't showing how it got here, it's hard to see what the
cause is. Can someone who's been here before help me out?

Was the Catalog object not defined properly or not initialized properly? If
not, how is the Catalog storage object supposed to be initialized?

-- Thanks
-- Loren