How to know if a LIveElement is alive :)
Hi, I wonder know if my nevow.athena.LiveElement intances are alive. This means for example, the web browser was now closed. I've been checking the API documentation at http://buildbot.divmod.org/apidocs/nevow.athena.LiveElement.html but didn't fin any sutable method for asking this. How do you do this stuff? Thanks, -- Juanjo Conti
2009/6/26 Juanjo Conti <jjconti@gmail.com>:
Hi, I wonder know if my nevow.athena.LiveElement intances are alive. This means for example, the web browser was now closed.
I've been checking the API documentation at http://buildbot.divmod.org/apidocs/nevow.athena.LiveElement.html but didn't fin any sutable method for asking this.
I thought I could use the LiveElement detached method http://buildbot.divmod.org/apidocs/nevow.athena._LiveMixin.html#detached but it semms not to be called when I close the browser where a LIveElement is living... -- Juanjo Conti
Juanjo Conti wrote:
2009/6/26 Juanjo Conti <jjconti@gmail.com>:
Hi, I wonder know if my nevow.athena.LiveElement intances are alive. This means for example, the web browser was now closed.
I've been checking the API documentation at http://buildbot.divmod.org/apidocs/nevow.athena.LiveElement.html but didn't fin any sutable method for asking this.
I thought I could use the LiveElement detached method http://buildbot.divmod.org/apidocs/nevow.athena._LiveMixin.html#detached but it semms not to be called when I close the browser where a LIveElement is living...
Hello, 2 months back I've had same question - working solution from Werner is in attached message. Regards, Paul
Thanks! I'll try it. So... what is detached for? 2009/6/26 Paul Reznicek <maillists@ivsn.com>:
Juanjo Conti wrote:
2009/6/26 Juanjo Conti <jjconti@gmail.com>:
Hi, I wonder know if my nevow.athena.LiveElement intances are alive. This means for example, the web browser was now closed.
I've been checking the API documentation at http://buildbot.divmod.org/apidocs/nevow.athena.LiveElement.html but didn't fin any sutable method for asking this.
I thought I could use the LiveElement detached method http://buildbot.divmod.org/apidocs/nevow.athena._LiveMixin.html#detached but it semms not to be called when I close the browser where a LIveElement is living...
Hello, 2 months back I've had same question - working solution from Werner is in attached message. Regards, Paul
---------- Mensaje reenviado ---------- From: Werner Thie <wthie@thiengineering.ch> To: Twisted Web World <twisted-web@twistedmatrix.com> Date: Wed, 22 Apr 2009 16:44:17 +0200 Subject: Re: [Twisted-web] Athena LiveElement: how to putChild under unique session URL? Paul Reznicek wrote:
glyph@divmod.com wrote:
On 21 Apr, 08:57 pm, maillists@ivsn.com wrote:
Hello All,
LiveElement is fantastic, but I'm too stupid to find out, how to put temporary page under sessiop URL... This work for js modules at start like: http://localhost:8080/user/<HASH clientID>/jsmodule/athena_test
I'd like to add temporary during run time something like: http://localhost:8080/user/<HASH clientID>/your_data page or staticFile, which should exists only few minutes.
Caveat is, that instances of gone clients are keeping in memory. Is there a way to find out, that a client is gone (closed browser or switched to other site)?
Welcome to the land of garbage collecting languages... What was the losing memory of the C++ ages is now the not releasing memory because of noncollectable garbage and server processes eating all the memory the machine has. I had to learn it the hard way but NEVER ever store a reference to something like sessions, mind or the the hierarchy of your LiveElements unless you're prepared to handle the breakup of the reference at cleanup time. Also keep in mind that the object hierarchy of client and server must be in sync or you're risking that the detach functionality does not work as advertised. Please see the detach/detached functionality in athena.py
class thePage(athena.LivePage):
def beforeRender(self, ctx): : d = self.notifyOnDisconnect() d.addErrback(self.disconn)
def disconn(self, reason): """ we will be called back when the client disconnects, just iterate over all children and call a disconnected func if available """ for child in self.liveFragmentChildren: if hasattr(child, 'disconnected'): child.disconnected(reason);
Werner
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
-- Juanjo Conti
On Sat, Jun 27, 2009 at 4:25 AM, Juanjo Conti<jjconti@gmail.com> wrote:
Thanks! I'll try it.
So... what is detached for?
You can call detach() on a widget in preparation for dynamically removing it from the page; once the detach process is complete, detached() is called. http://divmod.org/trac/ticket/2870 may be a better way to do what you want, once it has been implemented. -- mithrandi, i Ainil en-Balandor, a faer Ambar
Worked great. Thanks. 2009/6/28 Tristan Seligmann <mithrandi@mithrandi.net>:
On Sat, Jun 27, 2009 at 4:25 AM, Juanjo Conti<jjconti@gmail.com> wrote:
Thanks! I'll try it.
So... what is detached for?
You can call detach() on a widget in preparation for dynamically removing it from the page; once the detach process is complete, detached() is called.
http://divmod.org/trac/ticket/2870 may be a better way to do what you want, once it has been implemented. -- mithrandi, i Ainil en-Balandor, a faer Ambar
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
-- Juanjo Conti
participants (3)
-
Juanjo Conti
-
Paul Reznicek
-
Tristan Seligmann