I've got a resource that a) dynamically builds it's children using getChild
and b) I'd like to have trailing slashes.
It seems like a lot of work - is there a facility to do this already in
twisted.web.resource.Resource?
It seems like in every resource's render(), I need to do something like:
def render(self, request):
if request.prepath[-1] != '':
request.redirect(request.childLink(""))
request.finish()
return ""
else:
return resource.Resource.render(self, request)
And every getChild needs to look like this:
def getChild(self, path, request):
if path == '':
return self
elif path == 'edit':
return CrudEdit()
else:
return None
It looks like overriding this wouldn't be much better - since if I still
want to use render(), the child needs to remember to call
TrailingSlashResource.render(self, request) in its render() - same with
getChild. Decorators need to decorate both methods as well.
Is there a facility in twisted.web that does this? I'm not using nevow,
which appears to just have an addSlash property on it's Page objects.
Thanks all.
[email protected]
_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web