[Twisted-web] Athena LiveElement: how to putChild under unique session URL?

glyph at divmod.com glyph at divmod.com
Wed Apr 22 07:47:58 EDT 2009

On 21 Apr, 08:57 pm, maillists at 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.
>How can I add a child to the livepage session path?

The magical hash URL you're referring to is just an alias for your page 
instance.  So all you need to do is, in your LiveElement:

    self.page.putChild("your_data", YourDataResource())

That YourDataResource() object (and its attendant URL) will then live as 
long as your LivePage connection does.

This is an interesting use-case, and it should work fine - but be aware 
that you're relying on a pretty weird little corner of implementation 
details here.  It certainly never occurred to *me* that somebody would 
want to do this :).

Particularly, there's no public API for generating this URL; you'll have 
to rely on the fact that url.here.child(self.clientID) keeps working.

More information about the Twisted-web mailing list