Timur Izhbulatov wrote at 2005-8-11 12:16 +0400:
... I have a simple Zope product which is an ObjectManager descendant and contains a database connection and a ZSQL method. It creates these objects during its initialisation.
app.inventory <Inventory instance at b7300f20> app.inventory['db-connection'] <Connection instance at b724a980> app.inventory.list <SQL instance at b724a8f0>
Everything is OK except one thing. A problem appears when I go to the manage_main page of the ZSQL method. It can't find any database connection using the SQLConnectionsIDs function from the ${ZOPE_HOME}/lib/python/Products/ZSQLMethods/SQL.py module.
The code of "SQLConnectionIDs" looks like this: ... for o in self.objectValues(): if (hasattr(o,'_isAnSQLConnection') and o._isAnSQLConnection and hasattr(o,'id')): Thus, a candidate "SQLConnection" must have an id. Now, when you create an object programmatically, it is quite easy to forget to give it an id (specifying the id in "_setObject" is not enough; the object itself must contain the id redundantly). -- Dieter