From 09953968172935ac5665cf75f0de87961d1741fe Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Tue, 31 Mar 2009 21:40:40 +0000 Subject: [PATCH] [1.0.X] Fixed #9883: no longer do strange things with whitespace in the linebreaks filter. Thanks, keithb. Backport of r10225 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10292 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/utils/html.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django/utils/html.py b/django/utils/html.py index 9b3fad8b03..c985538041 100644 --- a/django/utils/html.py +++ b/django/utils/html.py @@ -46,9 +46,9 @@ def linebreaks(value, autoescape=False): value = re.sub(r'\r\n|\r|\n', '\n', force_unicode(value)) # normalize newlines paras = re.split('\n{2,}', value) if autoescape: - paras = [u'

%s

' % escape(p.strip()).replace('\n', '
') for p in paras] + paras = [u'

%s

' % escape(p).replace('\n', '
') for p in paras] else: - paras = [u'

%s

' % p.strip().replace('\n', '
') for p in paras] + paras = [u'

%s

' % p.replace('\n', '
') for p in paras] return u'\n\n'.join(paras) linebreaks = allow_lazy(linebreaks, unicode)