Hi Luke, I actually faced a problem similar to this when I ported CBV from 1.3 to 1.2, and then tried to use the TemplateResponse with a couple of middleware decorators that I created from some custom middleware classes. If I recall properly, I was also having backwards incompatibility problems with some other middleware classes that I had installed.
The solution for me was actually very simple: instead of raising a ContentNotRenderedError on line 110 of django/template/response.py, I modified the code of _get_content() to call self.render(), that way making a TemplateResponse look just like a standard response with a static "content" field. Doing it this way still allows TemplateResponse to be useful, it just requires you to be careful how you order middleware classes so that the template context is updated before request.content is accessed (i.e. at the very front). It's a small race condition, but not inconsistent with the other ordering issues that go along with using middleware. That being said, I don't know if the bug I encountered was exactly the same as what you are describing, I can't quite recall the details, but I just wanted to throw this out there anyway. This may not be a complete or ideal solution, but if it works, it seems like a better option than changing the middleware API--and better than making backwards-incompatible changes to decorator_from_middleware. Regards, Ed Gutierrez -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.