[Twisted-web] livepage and IClientHandle().transient

Valentino Volonghi aka Dialtone dialtone at divmod.com
Sat Jun 24 06:09:12 CDT 2006

On Sat, 24 Jun 2006 02:04:21 +0200, Alessandro <aleuser at inwind.it> wrote:
>  I'm in trouble with livepage. Looking at livepage.LivePage.__doc__ I can 
>see this example:
>def render_clickable(self, ctx, data):
>             def hello(ctx):
>                 return livepage.alert("Hello, world. You can only click me 
>             return ctx.tag(onclick=IClientHandle(ctx).transient(hello))
>I have tested it, but I can't find IClientHandle inside the "normal" page 
>context; I can find it only inside the handle_XX's context, but I can't use 
>"transient" (It doesn't function, I can click as many times as I want).

Check that you are using livepage.LivePage as a base class and report here the code you are using _completely_.

>How can I "grant the client the capability of calling a handler once and 
>exactly once"?

With transient.

>I'm going to use the server side sessions and something similar "return 
>client.get(btn_idname).disable=true"... but I don't like it.

Sessions should not be used at all because you must always be able to serialize them and their fields should remain somewhat fixed.

I suggest moving to Athena which is newer and more actively maintained and better overall, moving from one to the other is not very complex or hard if your app is not medium-big and there is a considerable gain in code complexity using Athena (less closures and such).

More information about the Twisted-web mailing list