Date: Fri, 12 Aug 2005 10:48:44 +0400 From: Timur Izhbulatov <[EMAIL PROTECTED]> To: Dieter Maurer <[EMAIL PROTECTED]> Subject: Re: [Zope] Aquisition
No, I don't forget to set the id. All objects which my product contains do have an id: # in __init__ self._setObject(add.id, add) self._setObject(search.id, search) self._setObject(conn.id, conn) WARN("add.id: %s" % add.id) WARN("search.id: %s" % search.id) WARN("conn.id: %s" % conn.id) >>> app.inventory.id 'inventory' >>> app.inventory.add.id 'add' >>> app.inventory.search.id 'search' >>> app.inventory['db-connection'].id 'db-connection' Also I can see it in the log file: 2005-08-12T10:31:17 PROBLEM(100) Inventory add.id: add ------ 2005-08-12T10:31:17 PROBLEM(100) Inventory search.id: search ------ 2005-08-12T10:31:17 PROBLEM(100) Inventory conn.id: db-connection But the connection still can only be found if it's in the root folder. That's really weird. On Thu, Aug 11, 2005 at 08:25:22PM +0200, Dieter Maurer wrote: > 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 -- Timur Izhbulatov OILspace, 26 Leninskaya sloboda, bld. 2, 2nd floor, 115280 Moscow, Russia P:+7 095 105 7245 + ext.205 F:+7 095 105 7246 E:[EMAIL PROTECTED] Building Successful Supply Chains - One Solution At A Time. www.oilspace.com _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )