[Twisted-web] [Nevow] childFactory being called more than once with

Manlio Perillo manlio_perillo at libero.it
Wed Feb 21 04:19:41 CST 2007

Valentino Volonghi aka Dialtone ha scritto:
> On Tue, 20 Feb 2007 21:44:48 +0100, Manlio Perillo 
> <manlio_perillo at libero.it> wrote:
>> I do not understand why, but childFactory is called 2 times per request.
>> If I replace the n:macro with a n:render, childFactory is called 3 times?
>> Why is this happening?
> Pretty normal if you use addSlash=True while not putting an ending / at 
> every
> url.
> There's no link between childFactory and macro rendering.

Just forget it!

I have a personalized locateChild in the base class, where I do:

     def locateChild(self, ctx, segments):
         request = inevow.IRequest(ctx)
         if request.args.get('login-failure'):
             import login

             return login.Login(self.avatar, failure=True), ''

         res = rend.Page.locateChild(self, ctx, segments)
         if res == rend.NotFound:
             return NotFound(self.avatar), ''

         return rend.Page.locateChild(self, ctx, segments) # <===


By the way, is this code the best way to handle a login failure?

Moreover, I still do not understand why, when replacing macro with 
render, locateChild is called 3 times, instead of 2.

Regards   Manlio Perillo

More information about the Twisted-web mailing list