[Twisted-web] Athena javascript question
Juanjo Conti
jjconti at gmail.com
Thu Jun 25 15:17:20 EDT 2009
Hi all,
I used Twisted to write a small server and now I am using Nevow.Athena
to write a web administrative interface. I got the tutorials running
and now I am changing it to reach what I want for my webapp.
The problem I am having is in the javascript side. Whe I try this js:
/ import Nevow.Athena
TempDisplay.TempWidget = Nevow.Athena.Widget.subclass('TempDisplay.TempWidget');
TempDisplay.TempWidget.methods(
function __init__(self, node) {
TempDisplay.TempWidget.upcall(self, "__init__", node);
self.tempWidget = self.nodeByAttribute('name', 'terElement');
self.tempSalaTxt = document.createTextNode('');
self.tempSala = self.nodeByAttribute('name', 'temp_sala')
self.tempSala.appendChild(self.tempSalaTxt);
self.tempRetornoTxt = document.createTextNode('');
self.tempRetorno = self.nodeByAttribute('name', 'temp_retorno');
self.tempRetorno.appendChild(self.tempRetornoTxt);
self.tempExteriorTxt = document.createTextNode('');
self.tempExterior = self.nodeByAttribute('name', 'temp_exterior');
self.tempExterior.appendChild(self.tempExteriorTxt);
},
function doRead(self) {
// ejecuta funcion read en servidor
self.callRemote("read");
return false;
},
function actualizarValores(self, data) {
// llamada por servidor para actualizar valores
var valores = data.split(',');
self.tempSala.remove(self.tempSalaTxt);
self.tempSalaTxt = document.createTextNode(valores[0]);
self.tempSala.appendChild(self.tempSalaTxt);
self.tempRetorno(self.tempRetornoTxt);
self.tempRetornoTxt = document.createTextNode(valores[1]);
self.tempRetorno.appendChild(self.tempRetornoTxt);
self.tempExterior.remove(self.tempExteriorTxt);
self.tempExteriorTxt = document.createTextNode(valores[2]);
self.tempExterior.appendChild(self.tempExteriorTxt);
});
When the functión actualizarValores is excecuted from the server, I
get this error:
Unhandled error in Deferred:
Traceback (most recent call last):
File "c:\Python25\lib\site-packages\nevow\js\Divmod\Runtime\__init__.js", lin
566, in ([object Event])
d.callback(result);
--- <exception caught here> ---
File "c:\Python25\lib\site-packages\nevow\js\Divmod\Runtime\__init__.js", lin
566, in ([object Event])
d.callback(result);
File "c:\Python25\lib\site-packages\nevow\js\Divmod\__init__.js", line 249, i
([object Object])
return methodFunction.apply(this, args);
File "c:\Python25\lib\site-packages\nevow\js\Divmod\Defer.js", line 258, in c
llback([object Object],[object Object])
self._startRunCallbacks(result);
File "c:\Python25\lib\site-packages\nevow\js\Divmod\__init__.js", line 249, i
([object Object])
return methodFunction.apply(this, args);
File "c:\Python25\lib\site-packages\nevow\js\Divmod\Defer.js", line 255, in _
tartRunCallbacks([object Object],[object Object])
self._runCallbacks();
File "c:\Python25\lib\site-packages\nevow\js\Divmod\__init__.js", line 249, i
()
return methodFunction.apply(this, args);
File "c:\Python25\lib\site-packages\nevow\js\Divmod\Defer.js", line 229, in _
unCallbacks([object Object])
self._result = callback.apply(null, args);
File "c:\Python25\lib\site-packages\nevow\js\Nevow\Athena\__init__.js", line
92, in ([object Array])
self.messageReceived(result[1]);
File "c:\Python25\lib\site-packages\nevow\js\Divmod\__init__.js", line 249, i
([object Array])
return methodFunction.apply(this, args);
File "c:\Python25\lib\site-packages\nevow\js\Nevow\Athena\__init__.js", line
35, in messageReceived([object Object],[object Array])
self.page['action_'+actionName].apply(self.page, actionArgs);
File "c:\Python25\lib\site-packages\nevow\js\Divmod\__init__.js", line 249, i
("Nevow.Athena.callByAthenaID","s2c0",[object Array])
return methodFunction.apply(this, args);
File "c:\Python25\lib\site-packages\nevow\js\Nevow\Athena\__init__.js", line
48, in action_call([object Object],"Nevow.Athena.callByAthenaID","s2c0",[object
Array])
result = method.apply(target, funcArgs);
File "c:\Python25\lib\site-packages\nevow\js\Nevow\Athena\__init__.js", line
259, in (1,"actualizarValores",[object Array])
return method.apply(widget, varargs);
File "c:\Python25\lib\site-packages\nevow\js\Divmod\__init__.js", line 249, i
("21.4,27.8,31.8")
return methodFunction.apply(this, args);
File "C:\Documents and Settings\Teco2006\Escritorio\line\js\TempDisplay.js",
ine 34, in actualizarValores([object Object],"21.4,27.8,31.8")
self.tempSala.remove(self.tempSalaTxt);
nevow.athena.JSException: TypeError: self.tempSala.remove is not a function
As far as I know, remove is a valid javascript function. Why can't I
use it in this context?
Thanks in advance!
--
Juanjo Conti
More information about the Twisted-web
mailing list