X-Account-Key: account5
Return-Path: twisted-web@twistedmatrix.com
Received: from mx56.stngva01.us.mxservers.net (204.202.242.16)
	by mail08a.verio.de (RS ver 1.0.95vs) with SMTP id 0-0110841530
	for <maillists@ivsn.com>; Wed, 22 Apr 2009 16:45:31 +0200 (CEST)
Received: from unknown [66.35.39.65] (EHLO cube.twistedmatrix.com)
	by va1-mx56.stngva01.us.mxservers.net (mxl_mta-3.1.0-05)
	with ESMTP id
 a8d2fe94.2655173536.330503.00-009.va1-mx56.stngva01.us.mxservers.net
 (envelope-from <twisted-web-bounces@twistedmatrix.com>);
	Wed, 22 Apr 2009 10:45:30 -0400 (EDT)
Received: from localhost ([127.0.0.1] helo=cube.twistedmatrix.com)
	by cube.twistedmatrix.com with esmtp (Exim 4.60)
	(envelope-from <twisted-web-bounces@twistedmatrix.com>)
	id 1Lwdh6-0006wP-Fc; Wed, 22 Apr 2009 10:45:00 -0400
Received: from newton.metanet.ch ([80.74.158.130])
	by cube.twistedmatrix.com with esmtps
	(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
	(envelope-from <wthie@thiengineering.ch>) id 1Lwdh3-0006ta-AR
	for twisted-web@twistedmatrix.com; Wed, 22 Apr 2009 10:44:57 -0400
Received: (qmail 23555 invoked from network); 22 Apr 2009 16:44:18 +0200
Received: from 217-071-084-026.ip-tech.ch (HELO ?192.168.11.99?)
 (217.71.84.26)
	by newton.metanet.ch with (DHE-RSA-AES256-SHA encrypted) SMTP;
	22 Apr 2009 16:44:18 +0200
Message-ID: <49EF2D41.5090708@thiengineering.ch>
Date: Wed, 22 Apr 2009 16:44:17 +0200
From: Werner Thie <wthie@thiengineering.ch>
Organization: THIEngineering AG
User-Agent: Thunderbird 2.0.0.21 (Windows/20090302)
MIME-Version: 1.0
To: Twisted Web World <twisted-web@twistedmatrix.com>
Subject: Re: [Twisted-web] Athena LiveElement: how to putChild under unique
	session URL?
References: 
 <20090210013639.12853.421780875.divmod.quotient.8088@henry.divmod.com>
	<49EE332D.2070009@ivsn.com>
	<20090422114758.12555.1153349173.divmod.xquotient.8879@weber.divmod.com>
	<49EF1C68.5080503@ivsn.com>
In-Reply-To: <49EF1C68.5080503@ivsn.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-BeenThere: twisted-web@twistedmatrix.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: wthie@thiengineering.ch,
	Twisted Web World <twisted-web@twistedmatrix.com>
List-Id: Twisted Web World <twisted-web.twistedmatrix.com>
List-Unsubscribe: 
 <http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web>,
	<mailto:twisted-web-request@twistedmatrix.com?subject=unsubscribe>
List-Archive: <http://twistedmatrix.com/pipermail/twisted-web>
List-Post: <mailto:twisted-web@twistedmatrix.com>
List-Help: <mailto:twisted-web-request@twistedmatrix.com?subject=help>
List-Subscribe: 
 <http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web>,
	<mailto:twisted-web-request@twistedmatrix.com?subject=subscribe>
Sender: twisted-web-bounces@twistedmatrix.com
Errors-To: twisted-web-bounces@twistedmatrix.com
X-Spam: [F=0.2000000000; B=0.500(0); S=0.200(2009020301);
 MH=0.500(2009042215)]
X-MAIL-FROM: <twisted-web-bounces@twistedmatrix.com>
X-SOURCE-IP: [66.35.39.65]
X-SF-Loop: 1

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

