On Thu, Apr 23, 2009 at 5:06 AM, meppum <mmep...@gmail.com> wrote:
>
> sorry to bring this up again in a different thread, but the old thread
> was locked:
> http://groups.google.com/group/django-users/browse_thread/thread/4fe2774b35b14b82/5af08bf613ba1f4c?lnk=gst&q=meppum+template+test#5af08bf613ba1f4c
>
> is there a way to dynamically test to see if i will need to access
> response.context[0] or just response.context in my unit tests? it
> would make my code more portable when sharing it between sites that
> may have varying layers of template inheritance.

This has been fixed in trunk - regardless of whether the context is
flat or a list, you can ask for response.context['foo'] and get the
value of foo in the context.

In 1.0, you just need to do a type check to see if response.context is
a list (isinstance(response.context, list)) before you try to access
the data in the context.

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 django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to