There are some problems with the determination of the right content type for TurboJson and other template engines (see also ticket #1480).
If no content type is explicitly requested, the generic render() function in view/base.py calls a method get_content_type(user_agent) of the template engine, currently only implemented by TurboJson.
* Issue 1: TurboJson always returns "text/javascript", but nowadays "application/json" should be used. I'd like to change that, and make expose() also understand "application/json". MochiKit also uses that content type in loadJSONDoc.
* Issue 2: There is actually a case destinction for Opera as the user agent, where "text/plain" is returned. But since the user agent is always passed as None due to a bug in view/base.py, this case distinction has never been effective. And I don't know if it was ever needed, surely not for current Opera versions. So I'd like to completely remove that.
* Issue 3: Should get_content_type really be a function? If yes, what input parameters does it need? I think much more important than the user_agent are the accept header and the format parameter. For instance, if format is 'plain', then get_content_type (if implemented in TurboKid, for instance) should return 'text/plain'. Currently we need to set content_type explicitly to 'text/plain'.
* Issue 4: I noticed that the expose decorator gets passed the full Accept header in controller.py. But the Accept header can be a list. Shouldn't we better pass only the first item of that list?