Author: russellm
Date: 2007-03-20 06:07:52 -0500 (Tue, 20 Mar 2007)
New Revision: 4753
Modified:
django/trunk/django/utils/text.py
django/trunk/tests/regressiontests/defaultfilters/tests.py
Log:
Fixed #3714 -- Fixed handling of indented text in wordwrap template filter.
Thanks for the fix, Ian Clelland.
Modified: django/trunk/django/utils/text.py
===================================================================
--- django/trunk/django/utils/text.py 2007-03-19 11:57:53 UTC (rev 4752)
+++ django/trunk/django/utils/text.py 2007-03-20 11:07:52 UTC (rev 4753)
@@ -17,7 +17,7 @@
pos = len(word) - word.rfind('\n') - 1
for word in it:
if "\n" in word:
- lines = word.splitlines()
+ lines = word.split('\n')
else:
lines = (word,)
pos += len(lines[0]) + 1
Modified: django/trunk/tests/regressiontests/defaultfilters/tests.py
===================================================================
--- django/trunk/tests/regressiontests/defaultfilters/tests.py 2007-03-19
11:57:53 UTC (rev 4752)
+++ django/trunk/tests/regressiontests/defaultfilters/tests.py 2007-03-20
11:07:52 UTC (rev 4753)
@@ -133,6 +133,12 @@
>>> wordwrap('this is a long paragraph of text that really needs to be wrapped
>>> I\'m afraid', 14)
"this is a long\nparagraph of\ntext that\nreally needs\nto be wrapped\nI'm
afraid"
+>>> wordwrap('this is a short paragraph of text.\n But this line should be
indented',14)
+'this is a\nshort\nparagraph of\ntext.\n But this\nline should be\nindented'
+
+>>> wordwrap('this is a short paragraph of text.\n But this line should be
indented',15)
+'this is a short\nparagraph of\ntext.\n But this line\nshould be\nindented'
+
>>> ljust('test', 10)
'test '
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---