[Twisted-Python] Problems with LivePage

Hegedus, Matthew S matthew.s.hegedus at lmco.com
Mon Oct 27 16:40:19 EST 2003


I incorrectly retyped code. Please forgive. Here is a better look...

Xhtml file:

<html>
    <head>
        <title>generic</title>
    </head>
    <body>
        <table model="listdata" view="listdatatable"></table>
        <span view="webConduitGlue" />
    </body>
</html>

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')
         t.tr(bgcolor='eeeeee')
         for arow in listdata:
             t.tr()
             for entry in arow:
                 t.td().text(entry)
             t.td().form().input(type='button', value='REMOVE',
view='rmExercise')

    def wvupdate_rmExercise():
        return RmExerciseEventHandler(self)

class RmExerciseEventHandler(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

As a recap, I was having trouble with my browser handling <span
view="webConduitGlue" /> in my xhtml file, and I was having trouble
processing events when I click on buttons embedded inside of a table (or
just buttons in general). Anyone see anything wrong? Sorry for the extra
email traffic and inbox congestion.

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


More information about the Twisted-Python mailing list