[Twisted-web] overriding resource getting with nevow+twisted

Samuel Reynolds sam at SpinwardStars.com
Wed Nov 24 11:36:51 MST 2004


At 2004-11-24 09:51 AM -0700, you wrote:
>I could of course just re-assign the module-level getChildWithDefault,
>but this seems wrong, somehow -- is there a better way?
>
>(I am doing this because I want to implement aliases for some things
>-- e.g. I have URLs like /article/<ID> and want those to sometimes
>also be available at /some/other/url and I don't want clients to
>simply be redirected to /article/<ID>, which is sort of what happens
>if I just re-map the path in getPageContextForRequestContext)

With Nevow, the choke point is getDynamicChild:

def getDynamicChild(self, name, request):
     << CONDITIONALLY SERVE YOUR STUFF HERE >>

     # Fall through to default processing
     return super(MyRendererClass,self).getDynamicChild(name, request)

(Replace 'MyRendererClass' with your Renderer subclass, of course.)

- Sam

__________________________________________________________
Spinward Stars, LLC                        Samuel Reynolds
Software Consulting and Development           303-805-1446
http://SpinwardStars.com/            sam at SpinwardStars.com 





More information about the Twisted-web mailing list