From 140f4a69134da5524a987d2e3bd6f567911c4145 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Wed, 23 Nov 2005 23:29:25 +0000 Subject: [PATCH 1/2] Added TEMPLATE_DEBUG to docs/settings.txt git-svn-id: http://code.djangoproject.com/svn/django/trunk@1384 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/settings.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/settings.txt b/docs/settings.txt index eed9d03d39..66baeb0860 100644 --- a/docs/settings.txt +++ b/docs/settings.txt @@ -549,6 +549,23 @@ The ID, as an integer, of the current site in the ``sites`` database. This is used so that application data can hook into specific site(s) and a single database can manage content for multiple sites. +TEMPLATE_DEBUG +-------------- + +Default: ``False`` + +**Only available in Django development version.** + +A boolean that turns on/off template debug mode. If this is ``True``, the fancy +error page will display a detailed report for any ``TemplateSyntaxError``. This +report contains the relevant snippet of the template, with the appropriate line +highlighted. + +Note that Django only displays fancy error pages if ``DEBUG`` is ``True``, so you'll +want to set that to take advantage of this setting. + +See also DEBUG. + TEMPLATE_DIRS ------------- From eab4a2259657ec1193b3ea2fcdcdf3a4371397d8 Mon Sep 17 00:00:00 2001 From: Georg Bauer Date: Thu, 24 Nov 2005 00:06:36 +0000 Subject: [PATCH 2/2] changed the linebreaks_iter function to use str.find instead of re.finditer, because the latter one has problems with Python 2.3 git-svn-id: http://code.djangoproject.com/svn/django/trunk@1385 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/views/debug.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/django/views/debug.py b/django/views/debug.py index 47b51f73e1..6d90633de6 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -9,9 +9,10 @@ from os.path import dirname, join as pathjoin HIDDEN_SETTINGS = re.compile('SECRET|PASSWORD') def linebreak_iter(template_source): - newline_re = re.compile("^", re.M) - for match in newline_re.finditer(template_source): - yield match.start() + p = template_source.find('\n') + while p >= 0: + yield p + p = template_source.find('\n', p+1) yield len(template_source) + 1 def get_template_exception_info(exc_type, exc_value, tb): @@ -519,4 +520,4 @@ TECHNICAL_404_TEMPLATE = """ -""" \ No newline at end of file +"""