On Mar 6, 7:07 am, Aryeh Leib Taurog <v...@aryehleib.com> wrote:

> Let's say I have the following code:
>
> class MyClass:
>     def my_title(self):
>         if 'some string' not in self.get_another_object().x:
>             return 'Specific Title'
>
> Then I have a template:
>
> {% with instance_of_myclass as obj %}
> {% if obj.my_title %}
>   {{ obj.my_title }}
> {% else %}
>   Generic Title
> {% endif %}
>
> Sometimes self.get_another_object() returns an object which doesn't
> have attribute 'x' so my_title() raises an AttributeError exception.
> Under Django 1.2.4 the template renders as 'Generic Title,' but under
> 1.3.1 I get a server error.

Did you check the DEBUG and TEMPLATE_DEBUG flags in your settings ?

-- 
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