#14040: Python syntax errors in module loading propagate up
----------------------------+-----------------------------------------------
Reporter: [email protected] | Owner: nobody
Status: new | Milestone:
Component: Core framework | Version: 1.2
Keywords: | Stage: Unreviewed
Has_patch: 0 |
----------------------------+-----------------------------------------------
When template tags trigger the importing of modules with syntax errors,
import(name) in django/utils/importlib.py raises a SyntaxError which isn't
caught, and leads to confusing warnings about template syntax errors at a
higher level. One solution is to trap SyntaxErrors there and wrap them as
ImportErrors, which are trapped higher up.
e.g.:
django/utils/importlib.py:35
{{{
try:
__import__(name)
except SyntaxError, e:
raise ImportError("Syntax error in " + e.filename + " at line " +
str(e.lineno) + "(" + str(e.offset) + "): \"" + e.text + "\".")
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/14040>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.