Product initilization, acquisition and instance references
Hello, I'm making 2 products that relate to each other much like a Database Adapter and a Z SQL Method ... One provides services to the other. The classes themslves already exist for pure python, and I'm trying to wrap them into a Zope product. The first one works fine. The problem is the second one, which uses the first one. First of all, it looks like while the class is being instanciated, there isn't any acquisition yet ? getattr(self, <id of instance of first type of object> ) does not work as expected ... I need object 2 to get the instance of object 1 in order to instanciate it properly. Under normal python, one would create an instance of object 1, and pass it as a parameter when instanciating object 2. Is this making any sense ? :) Also, if acquisition did work and I did something like self.serviceprovider = getattr( self, <id of instance of other object> ) would I be storing a copy of the instance, or a reference to it ? Anyway I can persistently store a reference to it ? The detailed situation is this: I have a Connection object, and a Query object (They talk to a web service). The Connection object instanciates fine. The problem is that the Query object when being instanciated (And edited for that matter), wants to check that some of it's parameters are valid against the server information known and cached in the Connection object. But I can't seem to get to that object at instanciation !! Any help or insights would be much appreciated !! Thanks, Jean-François Doyon Internet Service Development and Systems Support GeoAccess Division Canadian Center for Remote Sensing Natural Resources Canada http://atlas.gc.ca Phone: (613) 992-4902 Fax: (613) 947-2410
On Wed, 2003-09-10 at 12:49, Jean-Francois.Doyon@CCRS.NRCan.gc.ca wrote:
The problem is the second one, which uses the first one. First of all, it looks like while the class is being instanciated, there isn't any acquisition yet ?
Did you use the Acquisition.Implicit mixin when you defined the class? HTH, Dylan
participants (2)
-
Dylan Reinhardt -
Jean-Francois.Doyon@CCRS.NRCan.gc.ca