Discussion:
Why doesn't Django display template line number of errors?
NealWalters
2009-09-10 23:57:28 UTC
Permalink
It's not always a problem, but sometimes it's tricky to find the bad
"end" or mismatched Django tag.
Why doesn't Django give you the line number where the error is
encountered within the template?
Is this on the wishlist already?

TemplateSyntaxError: Invalid block tag: 'end'

In other words, the following would be a big time saver:
TemplateSyntaxError: Invalid block tag: 'end' on line 17 of template:
abc.html


Thanks,
Neal Walters



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Tim
2009-09-11 01:13:17 UTC
Permalink
It does show line numbers. Scroll down past the yellow section on the
error page, and it will show you the line numbers, the line with the
error, and the lines surrounding it.

It should also say something like "In template /Users/tim/Sites/
website/templates/base.html, error at line 73"
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
NealWalters
2009-09-11 14:06:54 UTC
Permalink
Maybe on Google App Engine there is no error line?
Here's an example of an "endif" insteaf of an "endifequal".

Neal


Traceback (most recent call last):
File "c:\Program Files\Google\google_appengine\google\appengine\ext
\webapp\__init__.py", line 501, in __call__
handler.get(*groups)
File "d:\GoogleAppEngine\cumulus\web\adminReports.py", line 2296, in
get
self.renderPage('templates/reportGenericText.html',
templateDictionaryLocal)
File "d:\GoogleAppEngine\cumulus\web\adminReports.py", line 2206, in
renderPage
self.response.out.write(template.render(path, values))
File "c:\Program Files\Google\google_appengine\google\appengine\ext
\webapp\template.py", line 81, in render
return t.render(Context(template_dict))
File "c:\Program Files\Google\google_appengine\google\appengine\ext
\webapp\template.py", line 121, in wrap_render
return orig_render(context)
File "c:\Program Files\Google\google_appengine\lib\django\django
\template\__init__.py", line 168, in render
return self.nodelist.render(context)
File "c:\Program Files\Google\google_appengine\lib\django\django
\template\__init__.py", line 705, in render
bits.append(self.render_node(node, context))
File "c:\Program Files\Google\google_appengine\lib\django\django
\template\__init__.py", line 718, in render_node
return(node.render(context))
File "c:\Program Files\Google\google_appengine\lib\django\django
\template\loader_tags.py", line 63, in render
compiled_parent = self.get_parent(context)
File "c:\Program Files\Google\google_appengine\lib\django\django
\template\loader_tags.py", line 60, in get_parent
return get_template_from_string(source, origin, parent)
File "c:\Program Files\Google\google_appengine\lib\django\django
\template\loader.py", line 88, in get_template_from_string
return Template(source, origin, name)
File "c:\Program Files\Google\google_appengine\lib\django\django
\template\__init__.py", line 158, in __init__
self.nodelist = compile_string(template_string, origin)
File "c:\Program Files\Google\google_appengine\lib\django\django
\template\__init__.py", line 174, in compile_string
return parser.parse()
File "c:\Program Files\Google\google_appengine\lib\django\django
\template\__init__.py", line 273, in parse
compiled_result = compile_func(self, token)
File "c:\Program Files\Google\google_appengine\lib\django\django
\template\defaulttags.py", line 580, in ifequal
return do_ifequal(parser, token, False)
File "c:\Program Files\Google\google_appengine\lib\django\django
\template\defaulttags.py", line 557, in do_ifequal
nodelist_false = parser.parse((end_tag,))
File "c:\Program Files\Google\google_appengine\lib\django\django
\template\__init__.py", line 271, in parse
self.invalid_block_tag(token, command)
File "c:\Program Files\Google\google_appengine\lib\django\django
\template\__init__.py", line 315, in invalid_block_tag
raise self.error( token, "Invalid block tag: '%s'" % command)
TemplateSyntaxError: Invalid block tag: 'endif'
Post by Tim
It does show line numbers. Scroll down past the yellow section on the
error page, and it will show you the line numbers, the line with the
error, and the lines surrounding it.
It should also say something like "In template /Users/tim/Sites/
website/templates/base.html, error at line 73"
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
NealWalters
2009-10-07 21:38:24 UTC
Permalink
Any ideas on this question from about a month ago?
Thanks,
Neal

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Karen Tracey
2009-10-08 01:30:29 UTC
Permalink
Post by NealWalters
Any ideas on this question from about a month ago?
It was answered. Django does display the line number, along with the line
in error and surrounding lines, in the Django debug page. If Google App
Engine doesn't do that (don't you get Django debug pages under App Engine?),
then it's more likely you'll get a reason why or a workaround or pointer to
where to request it, in a forum that discusses Google App Engine.

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Loading...