Athena javascript question

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

On 07:17 pm, jjconti@gmail.com wrote:
As far as I know, remove is a valid javascript function. Why can't I use it in this context?
Happily, this isn't Athena's fault :-). Remove isn't a valid method of DOM nodes. Perhaps you wanted removeChild? http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1734834066

Thanks you very much. I'll try it later. BTW, Is it possible to use JQuery with Athena? -- Juanjo Conti

Depends what you mean by saying "with" :-) I used several 3rd-party JS libraries alongside Athena and they worked nicely. Even // import worked :-) -- M -----Original Message----- From: twisted-web-bounces@twistedmatrix.com [mailto:twisted-web-bounces@twistedmatrix.com] On Behalf Of Juanjo Conti Sent: Friday, June 26, 2009 4:54 AM To: Twisted Web World Subject: Re: [Twisted-web] Athena javascript question Thanks you very much. I'll try it later. BTW, Is it possible to use JQuery with Athena? -- Juanjo Conti _______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Could you provide a link to an example? 2009/6/26 Michał Pasternak <michal.dtz@gmail.com>:
Depends what you mean by saying "with" :-)
I used several 3rd-party JS libraries alongside Athena and they worked nicely. Even // import worked :-)
-- M
-----Original Message----- From: twisted-web-bounces@twistedmatrix.com [mailto:twisted-web-bounces@twistedmatrix.com] On Behalf Of Juanjo Conti Sent: Friday, June 26, 2009 4:54 AM To: Twisted Web World Subject: Re: [Twisted-web] Athena javascript question
Thanks you very much. I'll try it later.
BTW, Is it possible to use JQuery with Athena?
-- Juanjo Conti
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
-- Juanjo Conti

On 26 Jun 2009, at 16:18, Juanjo Conti wrote:
Could you provide a link to an example?
+1 We're using Nevow/Athena and we've reached the point where the UI needs to get more complex. It's Athena + (something) or we have to move to something like Cappuccino + (something). I think i'd rather find a simple upgrade path using jQuery or similar. I've seen a few examples of MochiKit used with Athena - but that might not be enough for us. pt.
2009/6/26 Michał Pasternak <michal.dtz@gmail.com>:
Depends what you mean by saying "with" :-)
I used several 3rd-party JS libraries alongside Athena and they worked nicely. Even // import worked :-)
participants (4)
-
glyph@divmod.com
-
Juanjo Conti
-
Michał Pasternak
-
Paul Thomas