#21707: Uninformative error if block.super is used inside the block tag of a base template -------------------------------------+------------------------------------- Reporter: mitar | Owner: Type: | anubhav9042 Cleanup/optimization | Status: assigned Component: Template system | Version: master Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 1 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by timo): Rather than try/except, it would probably be better to do: {{{ if not hasattr(self, 'context'): raise TemplateSyntaxError(...) }}} And make the message less definitive (e.g. include the original exception message and add "Did you use {{ block.super }} in a base template?". I am not sure, but there might be other cases where context could be missing so including the original exception could be helpful just in case. -- Ticket URL: <https://code.djangoproject.com/ticket/21707#comment:7> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.779446a34b6d05ab7bfefb554dbc4bf6%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.