Is this worthy of a ticket? Observed behavior: Django (v0.96) render_to_response renders a template but renders nothing for {{ form.as_table }} tag when (unbeknownst to the poor programmer) a TypeError exception is raised during the rendering of a custom newforms widget.
My preferred behavior: generate a traceback message in the browser There may be other kinds of exceptions that result in this behavior as well, I am only sure of this one. I spent many frustrating hours (granted the frustrating hours were my own fault; I am unfamiliar with Django & python debugging) trying to debug my custom fields and widgets when render_to_response would simply not output any HTML for the form, and encountered several different bugs along the way through brute force trial and error. My breakthrough came when I stopped hoping for a traceback in the browser and set a breakpoint in Wing and then used the debug probe to print the form. I had a bug in one of my custom widgets for newforms that resulted in a "TypeError: unsubscriptable object". I could have discovered it through python manage.py shell also. I readily admit my frustration was of my own making, and the form being absent in the browser was certainly a big tip-off that something was wrong. But isn't the suppression of exceptions like this (particularly in debug mode) non-desired behavior? >>> print myform Traceback (most recent call last): File "/usr/local/django/terry/ean/views/news.py", line 1, in ? # views for news items File "/usr/lib/python2.4/site-packages/django/newforms/util.py", line 26, in __str__ return self.__unicode__().encode(settings.DEFAULT_CHARSET) File "/usr/lib/python2.4/site-packages/django/newforms/forms.py", line 73, in __unicode__ return self.as_table() File "/usr/lib/python2.4/site-packages/django/newforms/forms.py", line 144, in as_table return self._html_output(u'<tr><th>%(label)s</th><td>%(errors)s% (field)s%(help_text)s</td></tr>', u'<tr><td colspan="2">%s</td></tr>', '</td></tr>', u'<br />%s', False) File "/usr/lib/python2.4/site-packages/django/newforms/forms.py", line 129, in _html_output output.append(normal_row % {'errors': bf_errors, 'label': label, 'field': unicode(bf), 'help_text': help_text}) File "/usr/lib/python2.4/site-packages/django/newforms/forms.py", line 227, in __unicode__ value = self.as_widget(self.field.widget) File "/usr/lib/python2.4/site-packages/django/newforms/forms.py", line 252, in as_widget return widget.render(self.html_name, data, attrs=attrs) File "/usr/local/django/terry/custom_widgets.py", line 75, in render if not new_attrs.has_key['id']: TypeError: unsubscriptable object --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---