From ed4eba154f21d26b687867d0b97e1512313e4bb5 Mon Sep 17 00:00:00 2001 From: Anand Chitipothu Date: Sat, 7 Nov 2009 14:29:26 +0530 Subject: [PATCH] hack to display correct template line numbers in debugerror --- web/debugerror.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/debugerror.py b/web/debugerror.py index 9beeaeca..28f42800 100644 --- a/web/debugerror.py +++ b/web/debugerror.py @@ -254,6 +254,11 @@ def _get_lines_from_file(filename, lineno, context_lines): filename = tback.tb_frame.f_code.co_filename function = tback.tb_frame.f_code.co_name lineno = tback.tb_lineno - 1 + + # hack to get correct line number for templates + if function == "__template__": + lineno -= 2 + pre_context_lineno, pre_context, context_line, post_context = \ _get_lines_from_file(filename, lineno, 7)