I have implemented the IRequestFilter interface and added a post_process_request() method which returns three results: template, data and content_type, as shown in the Porting from Genshi to Jinja howto. The content_type variable is passed in via the method call and not altered, and is the string "text/html"
However, when this gets processed via trac.web.main here, the content_type variable returned by the post_process_request() method gets transferred into the metadata variable and a few lines down here, the code expects metadata to have a "setdefault" method. As it's a string, it doesn't have this method and hence throws the AttributeError "''str' object has no attribute 'setdefault'".
I suspect I'm doing something wrong in my code, but I'm not sure what!