Skip to content

Entries published on November 29, 2008

1 entry published on this date. See also: all entries published in November 2008, full archive.

Another take on content negotiation

Today my co-worker Daniel posted a class which performs content negotiation for Django views, allowing you to write a single view which returns any of several types of responses (e.g., HTML, JSON, XML) according to the incoming HTTP Accept header. While it’s certainly cool, he notes a couple of issues with it (including the redundancy it introduces in URL configuration).

So let’s see if we can’t come up with a way to work around this.

Holiday decorations

It seems that the best way to approach this is to avoid the need to do too much rewriting in the view and URL code; it’d be nice to simply say, after the fact, what types of responses the view should be able to return without changing the view too much or tweaking the URL configuration over and over. And the natural way to do this in Python is with a …

Entry published November 29, 2008. Read full entry.