On Monday 30 May 2011, Laurens Van Houtven wrote:
My use case for this is txYoga <https://github.com/lvh/txyoga>. Long story short, it lets you write REST-y webapps. So, you could have something like:
http://www.twistedmatrix.com/labs/glyph
In local jargon, labs is a collection, and glyph is an element in it. Right now, the only collection that actually exists is an in-memory one, and the next one I'm going to write is a SQLite one, so blocking on child access seems relatively reasonable. In general, however, this should be implemented using Deferreds, since the information about glyph might be stored in a database far, far away.
A possible alternative would be to create a child resource that remembers the child name and do the database lookup in the render method. If there is a matching record, render a page with its data, otherwise render a 404 page. I cannot predict whether the resulting code would be clean or ugly though, so I don't know how feasible this approach is. Bye, Maarten