[Twisted-web] Error: nevow_clientToServerEvent is not defined (Firefox JS Console)

Donovan Preston dp at ulaluma.com
Thu Jun 30 10:24:50 MDT 2005


On Jun 29, 2005, at 8:54 PM, Uwe (Peter) Feldtmann wrote:

> Does the current svn checkout handle XUL?

Seems to :-)

> I've tried playing with it with mixed results.
>
> I need to send updated values to client fields and later to bring  
> em back. I've included slightly hacked versions of xul_nevow.py and  
> xul_example.xul  The label change works as expected but I'm not  
> handling the text fields properly.
>
> Can someone please nudge or kick me in the right direction?

Well, you had a simple problem in your example file. You defined a  
function at the module level named onCommand, which you presumably  
wanted to be called at some point, but you never called it. I have  
attached an updated example which eschews the function entirely and  
puts all the logic in the handle_onCommand method.

Note that it is still possible to program in the old style by doing  
IClientHandle(ctx) to get the client instance and repeatedly  
calling .send on it, but instead I have changed your example to  
return a list of javascript to send to the browser. Nevow now uses  
the normal rendering machinery to render javascript results from  
handlers and javascript which is pushed to the browser, so this is a  
natural way to express it.

Note that currently, you are required to include a newline or  
semicolon to delimit your statements; like nevow's html rendering,  
the javascript rendering does not currently insert newlines anywhere.  
I have suspected for a while that it would be safe to insert newlines  
in between list elements while rendering in a JavascriptContext, but  
I haven't tested this theory yet. If it is possible to insert these  
newlines automatically then the livepage.eol will no longer be  
necessary, which would be very nice.

Note that:

livepage.eol = livepage.js('\n') ## A newline character

Here is your working example (the XUL file didn't change at all):

-------------- next part --------------
A non-text attachment was scrubbed...
Name: xul_example.xul
Type: application/octet-stream
Size: 1875 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-web/attachments/20050630/c2d3468d/xul_example.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xul_nevow.py
Type: text/x-python-script
Size: 1002 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-web/attachments/20050630/c2d3468d/xul_nevow.bin


More information about the Twisted-web mailing list