[Twisted-web] TypedInterface implementation returned in a render_ method

Justin Johnson twisted-web@twistedmatrix.com
Mon, 15 Dec 2003 09:22:09 -0600


I have the following render_main method which returns the current tag,
but specifies an implementation of a TypedInterface as 'data', and
freeform.configure as a child node.

    def render_main(self, context, data):
        if "mkvob" in self.selected_menu_items:
            return context.tag(data=forms.MkvobForm())[
            freeform.configure ]
        else:
            return Base.render_main(self, context, data)


The TypedInterface is defined as follows:


class IMkvobForm(formless.TypedInterface):
    def do_mkvob(self,
                 request=formless.Request(),
                 tag=typed.VobTags(),
                 site=typed.Sites(),
                 other_sites=typed.Sites()):
        """Make a VOB

        Make a ClearCase VOB.
        """
    do_mkvob = formless.autocallable(do_mkvob)

class MkvobForm(object):
    __implements__ = IMkvobForm,

    def do_mkvob(self, request, tag, site, other_sites):
        vobs = tag.split(",")
        other_sites = other_sites.split(",")
        print "DEBUG: locals() = " + str(locals())
        Redirect("/")


Eventually this will do something useful.  This code succeeds in
displaying the form when I select the mkvob menu item.  However, when I
click submit, I get the following error before the Type coerce methods
are called.


2003/12/15 09:16 Central Standard Time [HTTPChannel,1,127.0.0.1]
Traceback (most
 recent call last):
          File "C:\Python23\Lib\site-packages\twisted\protocols\http.py",
          line 1
000, in rawDataReceived
            self.allContentReceived()
          File "C:\Python23\Lib\site-packages\twisted\protocols\http.py",
          line 9
91, in allContentReceived
            req.requestReceived(command, path, version)
          File "C:\Python23\Lib\site-packages\twisted\protocols\http.py",
          line 5
49, in requestReceived
            self.process()
          File "C:\svn\Quotient\nevow\appserver.py", line 99, in process
            return server.Request.process(self)
        --- <exception caught here> ---
          File "C:\Python23\Lib\site-packages\twisted\web\server.py",
          line 158,
in process
            resrc = self.site.getResourceFor(self)
          File "C:\svn\Quotient\nevow\appserver.py", line 125, in
          getResourceFor

            res = gener.getResourceForRequest(request)
          File "C:\svn\Quotient\nevow\appserver.py", line 50, in
          getResourceForR
equest
            return self.postForm(request, res, configurable, ctx,
            bindingName, r
equest.args)
          File "C:\svn\Quotient\nevow\appserver.py", line 53, in postForm
            return configurable.postForm(ctx, bindingName, args)
          File "C:\svn\Quotient\nevow\freeform.py", line 731, in postForm
            binding = configurable.getBinding(ctx, seg)
          File "C:\svn\Quotient\nevow\freeform.py", line 796, in
          getBinding
            raise ImproperInputError, self.original
        nevow.freeform.ImproperInputError: An unconfigurable object
        (None)



Does anyone know what I'm doing wrong here?
Thanks.
-Justin