[Twisted-web] Problem with Nevow changes

Matt Goodall matt at pollenation.net
Fri May 7 04:14:53 MDT 2004

On Fri, 2004-05-07 at 06:25, Alex Levy wrote:
> It seems like a couple things have broken (or, at the least, stopped
> behaving as they used to) since the freeform-patterned branch got merged
> back into trunk.
> For one, rend.Page.renderString() raises tracebacks. Ew.
> Second, something I haven't been able to figure out the cause of, method
> bindings that are part of a TypedInterface aren't being rendered with
> the proper values filled in.
> I've attached an example of what I mean; if you run this script with
> 'twistd -ony' using Nevow before the merge, the web form gets rendered
> with the appropriate values included. But after the merge, the forms
> appear blank. What gives?

IIRC, autocallable methods have never been populated from the
configurable object's data. You need to use form defaults for that,
which would look something like ...

        def render_edit(self, ctx, data):
            defs = ctx.locate(iformless.IFormDefaults)
            defs.setDefault('someMethod.one', self.myObject.one)
            defs.setDefault('someMethod.two', self.myObject.two)
            ... etc ...
Interestingly, setting the defaults as above prepopulates *both* forms.
I think it should only populate the self.orginal form. To populate the
self.myObject form I expected to need to set the default for the
myobject.someMethod.(one|two|three) key.

> Oh, and if you run this with python instead of twistd, you'll see the
> traceback that rend.Page.renderString() is raising. Added bonus. :P
    /  \__     Matt Goodall, Pollenation Internet Ltd
    \__/  \    w: http://www.pollenation.net
  __/  \__/    e: matt at pollenation.net
 /  \__/  \    t: +44 (0)113 2252500
 \__/  \__/
 /  \          Any views expressed are my own and do not necessarily
 \__/          reflect the views of my employer.

More information about the Twisted-web mailing list