redirecting root resource
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi alls, how can I redirect systematically the root url "/" ? Each time "/" is requested, I want to redirect to "/foo/bar", but this does not have to compromise other urls such "/baz/zoo", which have to be handled normally with RootResource.childFactory(). The only idea I have is to define the same docFactory and renderers for RootResource and BazZoo rend.Page, without doing a redirect: but this is very sad and, in fact, that's not what I want. any idea? br - -- efphe Today is Setting Orange, the 55th day of Chaos in the YOLD 3174 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFHwWWli7obm7aBjHcRAleQAJ492N2rguiUaobXgx1k1OFw9I6V6QCfcS1C pdORD0GZ97NRdvs67I+Q5Sg= =NWY2 -----END PGP SIGNATURE-----
On Sunday 24 February 2008, Federico Tomassini wrote:
how can I redirect systematically the root url "/" ?
(assuming you're using twisted.web, not web2 or nevow) On the root resource, add a child resource with the empty string as its name. That child resource will only be rendered for "/", not for anything deeper in the hierarchy. In the child resource's render() method, issue a redirect. Bye, Maarten
participants (2)
-
Federico Tomassini
-
Maarten ter Huurne