[Twisted-web] liveevil problem: nested functions get lost

Donovan Preston dp at ulaluma.com
Mon Feb 28 18:54:53 MST 2005

On Feb 28, 2005, at 3:09 PM, Federico Di Gregorio wrote:

> So the string won't be evaluated in the context of the
> nevow_clientToServerEvent() function but directly in the event call,
> isn't it? So hanlders like:
> 	handler(mycallable, "node.value")
> should now be written:
> 	handler(mycallable, liveevil.js("this.value"))
> substituting "this" to "node"? It is fine for me and even the "js" name
> is not too bad (i.e., I can't think of anything better right now.)

That is correct, and I hope it is ok. The way "literal" (to be renamed 
"js") is written is very convenient, too:

handler(mycallable, liveevil.js.this.value)

Would work just as well (__getattr__ constructs new literal instances). 
There is already a module-global "document" literal, so you can do 
livepage.document.getElementById. literal (js) provides __getitem__ as 
well as __call__ implementations.

I hope it all makes sense, it is somewhat experimental at this point. 
One good thing about this new implementation is that there are 
extensive javascript quoting unittests, where there were none before, 
so hopefully it is less buggy, more flexible, and less likely to change 
in the future.


More information about the Twisted-web mailing list