The points were just off the top of my head from memory, when I get back to work I'll have a look to see what the actual cases are.
Regarding the messages middleware, I *know* there's a problem. A message won't be marked as "read", since the template hasn't iterated the messages object by the time the middleware is triggered On Oct 23, 8:35 am, Mikhail Korobov <kmik...@googlemail.com> wrote: > Hi Chris, > > I don't see anything harmful neither in > django.contrib.messages.middleware.MessageMiddleware nor in > django.test.testcases.assertContains. > Messages middleware passes response as-is and assertContains reads > 'content' attribute and thus forces the baking. > > at lest the following test case forks fine for me: > > class AssertTestCase(TestCase): > def test_assert_contains(self): > request = RequestFactory().get('/') > template = Template('foo') > response = TemplateResponse(request, template) > self.assertContains(response, 'oo') > > Can you please provide more details? > > On 23 окт, 00:21, SmileyChris <smileych...@gmail.com> wrote: > > > > > > > > > In my use of TemplateResponse in a real project, we encountered two > > gotchas that I can think of off the top of my head: > > > 1. You need to explicitly bake the response if you are testing using > > assertContains > > 2. You need to explicitly bake the response before the > > contrib.messages middleware > > > On Oct 23, 1:32 am, Russell Keith-Magee <russ...@keith-magee.com> > > wrote: > > > > On Fri, Oct 22, 2010 at 7:32 PM, Mikhail Korobov <kmik...@googlemail.com> > > > wrote: > > > > Russell's comments were helpful in discovering the edge case. > > > > _set_content behaves differently for baked and non-baked responses: > > > > > response = render(request, Template('foo')) > > > > response.content = 'bar' > > > > print response.content # 'foo' > > > > response.content = 'baz' > > > > print response.content # 'baz' > > > > > This is confusing so I think responses should be marked as baked in > > > > _set_content, not in force_bake. > > > > > The patch that should resolve this concern and Russell's concerns > > > > regarding the > > > > tests:http://bitbucket.org/kmike/django/changeset/00f8be464749 > > > > > I'll take a look at docs and generic views integration later. > > > > > Should new generic views return TemplateResponse by default? > > > > I would have thought so. Is there a compelling reason why CBV's > > > shouldn't return a TemplateResponse? > > > > Yours, > > > Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@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.