Django

Code

Ticket #8031 (closed: fixed)

Opened 4 months ago

Last modified 4 months ago

Suppressing exceptions in templates harmful for debugging

Reported by: joerg@bec.de Assigned to: lukeplant
Milestone: Component: Template system
Version: SVN Keywords:
Cc: Triage Stage: Design decision needed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

Even when TEMPLATE_DEBUG is enabled, Django will currently silently suppress all exceptions during template rendering. This makes it hard to find typos in the template (misspelled variable names), but can also hide other errors.

The concrete problem I hit was the conversion to permalink and the resolver not knowing functions specified directly as object and not string. As the exception was ignored, all users of the permalink used the empty string.

It would be nice if the exceptions can be easily logged either to stderr (manage.py runserver) or some file, potentially using another debug option in settings.py.

Attachments

Change History

08/01/08 09:29:28 changed by lukeplant

  • needs_better_patch changed.
  • stage changed from Unreviewed to Design decision needed.
  • needs_tests changed.
  • needs_docs changed.

See this discussion:

http://groups.google.com/group/django-developers/browse_thread/thread/f323338045ac2e5e/

General conclusion: we need to examine individual tags and see whether they should fail silently or not. I agree that it is never useful for the URL tag to fail silently. I'll bring it up on the list

08/05/08 06:21:19 changed by lukeplant

  • owner changed from nobody to lukeplant.
  • status changed from new to assigned.

08/05/08 09:16:17 changed by lukeplant

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [8211]) Fixed #8031 - url tag no longer silences NoReverseMatch? exceptions since this is very rarely useful

08/05/08 09:25:42 changed by lukeplant

If there are any other tags where exceptions are being unhelpfully silenced, please open a new ticket. Silent variable failure is a deliberate feature e.g.

{{ foo.bar.baz }}

should return nothing if foo is None, or if foo.bar is None, or if foo.bar.baz is None.


Add/Change #8031 (Suppressing exceptions in templates harmful for debugging)




Change Properties
Action