[Twisted-web] Nevow IResource trouble

Remi Cool mailinglists at smartology.nl
Fri Nov 18 08:41:59 MST 2005

Remi Cool wrote:

>Hello, after batteling with XMLRPC and getting nevow to put something on
>the screen, I got stuck implementing a livepage and webform example.
>After changing the implements to inevow.IResource in httpResource, I got
>a message about a missing locateChild method (is that about the same as
>the getChild method in a twisted web resource?) ... I've created one,
>but I'm not shure if it's correct.
>Bottomline is I can't get it to work, not from the code and not from a
>resource file ... what's wrong with this code?
I was using twisted.web.static and not nevow.static and that mistake was
responsible for the cannotAdapt errors.

The webforms example worked after changing the ISimpleMethod class to:

class ISimpleMethod(TypedInterface):
    def simple(self, name=String(description="Your name."),
age=Integer(description="Your age.")):
        Please enter your name and age.
    simple = annotate.autocallable(simple)

The Livepage example also needed a little touchup ...

class Live(LivePage):
    addSlash = True
    docFactory = loaders.stan(
                tags.li(onclick="server.handle('greeter', this.name)",
                tags.li(onclick="server.handle('greeter', this.name)",
                tags.li(onclick="server.handle('greeter', this.name)",
    def __init__(self):

    def handle_greeter(self, ctx, value):
        return livepage.alert("you've clicked %s" % value)

Most important was the tags.head[livepage.glue] addition.

Now that everything works, I can go on to the next step (pfew) ...
calling the client from the server with livepage, sessions,
authentication and experimenting with nufox XUL.

- Remi -

More information about the Twisted-web mailing list