[Twisted-Python] Problem using LivePage/javascripts/event handlers

Hegedus, Matthew S matthew.s.hegedus at lmco.com
Mon Oct 27 15:02:23 EST 2003

I'm a relative noob to Twisted and Woven, but I'm trying to use them to
serve some dynamic web content without success. There's two spots that I am
most interested in:

When I include <span view="webConduitGlue" /> in my xhtml file, the browser
will spin its wheels forever. A big empty box is displayed at the bottom of
the browser window and the browser status displays Transferring data from
<myIP:port> ... . This behavior is consistent on Mozilla (I'm on Red Hat
Linux OS) and on the latest Netscape (7.1). I checked to make sure
javascript options were turned on in Netscape. Here is the Code:

Xhtml file:

        <table model="listdata" view="listdatatable"></table>
        <span view="webConduitGlue" />

Key Python/Twisted code:

class Epage(page.LivePage):
     def initialize(...):
         self.someListData = [['a', 'b', 'c'],
                                        ['d', 'e', 'f'],
                                        ['g', 'h', 'I']]

     def wmfactory_listdata(self, request):
         return self.someListData

     def wvupdate_listdatatable(self, request, node, listdata):
         l = lmx(node)
         d = l.div()
         t = d.table(border='0', cellspacing='2')
         for arow in listdata:
             for entry in arow:
             t.td().form().input(type='button', value='REMOVE',

    def wvupdate_rmExercise(controller.Controller):
        def initialize(self):
            self.view.addEventHandler("onclick", self.onClick)
            self.view.addEventHandler("onmouseover", self.onMouseOver)

        def onClick(self, request, widget):
            print self, "CLICKED!"

        def onMouseOver(self, request, widget, argument):
            print self, "MOUSE OVER!", argument

The browser will draw me a table with buttons, but these events don't seem
to get processed. So that brings me to the second trouble spot I am
interested in. For those who know, am I embedding buttons in my table in an
acceptable manner? Am I trying to handle events correctly? If the xhtml
webConduitGlue was working would my event handling work? Please feel free to
criticize any part of this code. Thanks,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20031027/ac125458/attachment.htm 

More information about the Twisted-Python mailing list