david / semanticdjango (http://semanticdjango.org/)
fork of django-trunk
The right time for a semantic contrib, that's my pony.
Clone this repository (size: 23.1 MB): HTTPS / SSH
$ hg clone http://code.welldev.org/semanticdjango
| commit 6470: | 9e72b0e9070d |
| parent 6469: | e2cebf3a4224 |
| branch: | default |
Fixed #10014 -- Don't crash when using debug template tag inside a block node tag.
Returning non-ASCII characters from TextNode.__repr__ was causing
problems in the BlockNode.__repr__ method (and probably in other places
we don't know about yet). We now forcibly convert to ascii and replace any
unconvertible characters, rather than returning some moderately
corrupted data in the non-ASCII case.
19 months ago
Changed (Δ65 bytes):
raw changeset »
django/template/__init__.py (3 lines added, 2 lines removed)
Up to file-list django/template/__init__.py:
| … | … | @@ -55,7 +55,7 @@ from django.template.context import Cont |
55 |
55 |
from django.utils.itercompat import is_iterable |
56 |
56 |
from django.utils.functional import curry, Promise |
57 |
57 |
from django.utils.text import smart_split |
58 |
from django.utils.encoding import smart_unicode, force_unicode |
|
58 |
from django.utils.encoding import smart_unicode, force_unicode, smart_str |
|
59 |
59 |
from django.utils.translation import ugettext as _ |
60 |
60 |
from django.utils.safestring import SafeData, EscapeData, mark_safe, mark_for_escaping |
61 |
61 |
from django.utils.html import escape |
| … | … | @@ -785,7 +785,8 @@ class TextNode(Node): |
785 |
785 |
self.s = s |
786 |
786 |
|
787 |
787 |
def __repr__(self): |
788 |
return "<Text Node: '%s'>" % s |
|
788 |
return "<Text Node: '%s'>" % smart_str(self.s[:25], 'ascii', |
|
789 |
errors='replace') |
|
789 |
790 |
|
790 |
791 |
def render(self, context): |
791 |
792 |
return self.s |
