[Twisted-web] Newbie question on handling args in URL string
Maarten ter Huurne
maarten at treewalker.org
Thu Mar 18 14:05:39 EDT 2010
On Thursday 18 March 2010, Rob Newman wrote:
> from twisted.web import server, static, rewrite
> from twisted.application import service, internet
>
> root = resource.Root()
>
> # Another file (resource.py) defines the resources Data() and Root()
>
> root.putChild('data', resource.Data())
> root.putChild('images', static.File(images_dir))
> root.putChild('jquery', static.File(js_dir))
>
> rewrite_root = rewrite.RewriterResource(root, pathToArgs)
>
> site = server.Site(rewrite_root)
I think it's the rewriting that is complicating things. Why not handle both
URL styles in the Data class?
Even if you want to rewrite, you could avoid a lot of duplication by putting
the RewriterResource under 'data' instead of in the root.
Bye,
Maarten
More information about the Twisted-web
mailing list