In pretty much similar way django can resolve (view_name, args, kwargs) into a string url I'd like to do the same with Resources in twisted.
So I would do urlresolve(Resource, args) and it would return a string url I could use in templates or redirects etc.
I'm thiking simply attaching the url to the Resource classes itself and giving it urlresolve method to handle the dynamic arguments. I know this duplicates the url information but it would be good enough for me right now. I think it should actually be pretty simple to support this properly but I'd expect there already exists something, I was just unable to find it.
You are right, I don't think that you can do this with Twisted. The reason is that a
Resource
only knows about its subresources, not it's place in the hierarchy. I.e.I think your idea about attaching a url field to a
Resource
is good. Then you can do something of the sort: