Hi My problem is that the client connection must be started as soon as Zope starts up. Ie, the attribute must be initialized prior to accessing it from within the Zope context. As soon as Zope starts, my client connection must be made, so that the remote server via a persistent connection to the client, can invoke callback methods when an event occurs on the server's side. So, the connection attribute is rarely ever called from within the same "process". Is'nt there a "startup" event for Zope(event indication all modules are finished loaded)? Thanks again. Herman Lbh pna'g gehfg lbhe rlrf vs lbhe vzntvangvba'f bhg bs sbphf. -Znex Gjnva ----- Original Message ----- From: "Alexis Roda" <arv@si.urv.es> To: "Herman Geldenhuys" <hgeldenhuys@gmsonline.co.za> Cc: "zope" <zope@zope.org> Sent: Monday, July 28, 2003 1:57 PM Subject: Re: [Zope] Running a script at Zope startup
---------- From: Alexis Roda[SMTP:ARV@SI.URV.ES] Sent: Monday, July 28, 2003 1:57:09 PM To: Herman Geldenhuys Cc: zope Subject: Re: [Zope] Running a script at Zope startup Auto forwarded by a Rule
Herman Geldenhuys wrote:
Thanks Tino!
I understand that I need to initialize a _v_ attribute each time I
create my
client connection, seeing that it cannot be stored in the ZODB. My problem is that I need a way to initiate that attribute at Zope's startup. Lets say that there are certain ZOPE objects in the hierarchy of ZOPE. I need to initialize all these objects _v_clientConnection attributes at Zope's startup. Does anybody know of a way?
I have not followed the thread, so I may be missing something, but I think that Tino's answer is right. You may achieve this defining a getter method, something like:
def get_client_connection(self) : if not hasattr(self, "_v_clientConnection") : self._v_clientConnection = xxxxx return sef._v_clientConnection
if you access this attribute through the method, and never directly, you'll always get a "valid" client connection.
HTH -- //// (@ @) ---------------------------oOO----(_)----OOo------------------------ Los pecados de los tres mundos desapareceran conmigo. Alexis Roda - Universitat Rovira i Virgili - Reus, Tarragona (Spain) --------------------------------------------------------------------
_______________________________________________ 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 )