----- Original Message ----- From: "Garion" <jsuther1@twcny.rr.com>
I have a folder off my root folder that I'll call MyWebSite... In MyWebSite, I have a MySQL Connection defined... When I add an instance my new product, I want it to save various bits into tables off the MySQL Connection, and use the LAST_INSERT_ID for the ID of the object..
My problem seems to be when I try to do this in the __init__ of my product, I haven't aquired the environment, and tells me that it can't find MySQL Connection..
Right before the setObject call, you should have references to both the new object and the container into which you are about to put it. You need to call a method on the object, in an acquisition context, which does the SQL setup, then put it in the container. Here's the general pattern (untested): obj = ThingClass() obj.__of__(container).install() container._setObject(obj.id, obj) You provide 'install'. The __of__ call is inherited from an acquisition class, and gives you an acquisition wrapper. Cheers, Evan @ 4-am & digicool