On 4/3/08, Tony <[EMAIL PROTECTED]> wrote:
>
>  I keep getting an AttributeError then I specify
>  "self.assertEqual(response.template.name, 'index.html')"
>  I keep getting...
>  AttributeError: 'list' object has no attribute 'name'
>
>  Is there something I have missed in the setup?

Yes, but it's not necessarily obvious. response.template will return a
list if multiple templates have been used in the rendering of a view.
The most common cause of this will be one template that extends
another - in this case, both templates (parent and child) will be
returned as a list to response.template. This is discussed in the
documentation for the Response object.

Since this can be a pain to work with, Django provides some helper
assertions. In your case, rather than testing that
response.template.name == 'index.html', use assertTemplateUsed() -
again, more details in the documentation.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to