22 Jul
2003
22 Jul
'03
6:49 p.m.
Chris Bruce wrote:
I want to create a product and allow the user to specify the database connection to use. If so, how do you reference an existing object in your product code.
Acquisition! Product class instances which inherit from the correct base classes will acquire properly. So inside a method for your Product class, you can: self.db_connection.do_something() presuming "db_connection" is the id of a Zope object that will be acquired from your Product. You could also store the "URL" of the object you want to use as a string and then use restrictedTraverse(string) to get a handle to the object itself. HTH, JZ