[Twisted-web] IRedirectAfterPost

vicky vlupien at drummonddesigns.com
Thu May 27 08:34:40 MDT 2004


I finally found where the probleme is. It's in the file Rend.py and in the
locateChild function of the class FreeformChildMixin.  The problem is the
content of context. To solve my problem, it was necessary to put
request.context automatically in context instead of verifying if the context
is empty. Otherwise the IRedirectAfterPost works once out of two.    

I would like to know if this change can cause many other problems and if it
is possible for you to change it directly in the code so when I'll update
nevow the change will be in it.

Here's the class with the modification I made:

class FreeformChildMixin:
    """Mixin that handles locateChild for freeform segments."""
    def locateChild(self, request, segments):
        ## The method or property name we are going to validate ainst/affect
        bindingName = None

        name = segments[0]
        if name.startswith('freeform_post!'):
            configurableName, bindingName = name.split('!')[1:3]
        elif name.startswith('freeform-action-post!'):
            configurableName, request.args['freeform-actee'] =
            bindingName = request.args['freeform-action'][0]
        if bindingName:

            #this is where I made my change
            #Instead of verifying if the ctx is empty, I automatically put
#request.context in ctx            
            ctx = request.context
            self.context = ctx
            ctx.remember(self, inevow.IResource)
            ctx.remember(request, inevow.IRequest)
            cf = iformless.IConfigurableFactory(self)
            c = cf.locateConfigurable(ctx, configurableName)
            return self.webFormPost(request, self, c, ctx, bindingName,
        return NotFound



More information about the Twisted-web mailing list