#27140: TypeError not reported from a template
---------------------------------+--------------------
     Reporter:  azmeuk           |      Owner:  nobody
         Type:  Bug              |     Status:  new
    Component:  Template system  |    Version:  1.10
     Severity:  Normal           |   Keywords:
 Triage Stage:  Unreviewed       |  Has patch:  0
Easy pickings:  0                |      UI/UX:  0
---------------------------------+--------------------
 If you try to access an object property in a django template, and this
 property raises a TypeError, then nothing will be raised. If it is, let's
 say, a ZeroDivisionError, then the exception is raised.


 {{{
 from django.template import Context, Template
 class FooClassTypeError:
     @property
     def fooproperty(self):
         raise TypeError
         return "somevalue"

 class FooClass:
     @property
     def fooproperty(self):
         return 1/0

 t = Template("{{ obj.fooproperty }}")

 # This call does not raise anything
 t.render(Context(dict(obj=FooClassTypeError())))

 # This call raises an exception
 t.render(Context(dict(obj=FooClass())))
 }}}

 I think the expected behavior is that both exceptions should be raised.
 What do you think?

--
Ticket URL: <https://code.djangoproject.com/ticket/27140>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.0b262a2343e98f1eb52ab09ea73657dd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to