[Twisted-web] liveevil problem: nested functions get lost

Federico Di Gregorio fog at initd.org
Fri Feb 25 18:16:36 MST 2005


Hi all,

I don't know if this is a known problem or the way it is supposed to
work but the following code results in a "lost" liveevil handler:

class Blah(rend.Page):
    def render_blah(self, ctx, data):
        def do_something(client):
            client.alert("You will never see this message!")
        return ctx.tag.clear()[T.span(
            onclick=liveevil.handler(do_something))["Click me"]]

The do_something is not recognized as a closure (actually it is not :)
so its "path" is saved away as module.do_something and does not get
resolved at call time. I know about the identifier keyword something
about it should probably be added to the docs. Maybe is would be even
better (and safer) to remove the reflect part and use only the events.

federico





More information about the Twisted-web mailing list