Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#8265 closed (duplicate)

Debug template exception message is confuse

Reported by: Marinho Brandão Owned by: nobody
Component: Template system Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When some error happens and the debug page for error 500 is shown with debug informations, the exception value is shown as a H2 element, like this:

Caught an exception while rendering: The 'image' attribute has no file associated with it. Original Traceback (most recent call last): File "../django/django/template/debug.py", line 71, in render_node result = node.render(context) File "../django/django/template/defaulttags.py", line 148, in render nodelist.append(node.render(context)) File "../django/django/template/debug.py", line 87, in render output = force_unicode(self.filter_expression.resolve(context)) File "../django/django/template/__init__.py", line 518, in resolve obj = self.var.resolve(context) File "../django/django/template/__init__.py", line 659, in resolve value = self._resolve_lookup(context) File "../django/django/template/__init__.py", line 688, in _resolve_lookup current = getattr(current, bit) File "/arquivos/Trabalhos/WN/Cranes/cranes_com/apps/spares/models.py", line 108, in __getattr__ thumbnail = get_image_thumbnail_filename() File "/arquivos/Trabalhos/WN/Cranes/cranes_com/apps/spares/models.py", line 100, in get_image_thumbnail_filename file, ext = os.path.splitext(self.image.path) File "../django/django/db/models/fields/files.py", line 50, in _get_path self._require_file() File "../django/django/db/models/fields/files.py", line 40, in _require_file raise ValueError("The '%s' attribute has no file associated with it." % self.field.name) ValueError: The 'image' attribute has no file associated with it. 

This is VERY confuse and make developer spent some time to find the error message and the file/line where the error occured.

My suggestion is change the H2 tag to PRE, with some CSS changes, so, the line breaks are respected exactly as they are when Python raises the exception.

Attachments (1)

8265.diff (753 bytes ) - added by Marinho Brandão 16 years ago.

Download all attachments as: .zip

Change History (3)

by Marinho Brandão, 16 years ago

Attachment: 8265.diff added

comment:1 by Malcolm Tredinnick, 16 years ago

Resolution: duplicate
Status: newclosed

This is basically the same as #8178.

comment:2 by (none), 16 years ago

milestone: 1.0 maybe

Milestone 1.0 maybe deleted

Note: See TracTickets for help on using tickets.
Back to Top