mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[1.7.x] Fixed #23060 -- Prevented UnicodeDecodeError in debug templatetag
Backport of 08451f17d0 from master.
This commit is contained in:
@@ -10,6 +10,7 @@ import warnings
|
||||
|
||||
from django import template
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import Group
|
||||
from django.core import urlresolvers
|
||||
from django.template import (base as template_base, loader, Context,
|
||||
RequestContext, Template, TemplateSyntaxError)
|
||||
@@ -524,6 +525,15 @@ class TemplateRegressionTests(TestCase):
|
||||
with self.assertRaises(urlresolvers.NoReverseMatch):
|
||||
t.render(Context({}))
|
||||
|
||||
def test_debug_tag_non_ascii(self):
|
||||
"""
|
||||
Test non-ASCII model representation in debug output (#23060).
|
||||
"""
|
||||
Group.objects.create(name="清風")
|
||||
c1 = Context({"objs": Group.objects.all()})
|
||||
t1 = Template('{% debug %}')
|
||||
self.assertIn("清風", t1.render(c1))
|
||||
|
||||
|
||||
# Set ALLOWED_INCLUDE_ROOTS so that ssi works.
|
||||
@override_settings(MEDIA_URL="/media/", STATIC_URL="/static/",
|
||||
|
||||
Reference in New Issue
Block a user