diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 12777372f5..37e765c715 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -36,6 +36,7 @@ Changelog * Fix: Ordering pages in the explorer by reverse 'last updated' time now puts pages with no revisions at the top * Fix: WagtailTestUtils now works correctly on custom user models without a ``username`` field (Adam Bolfik) * Fix: Logging in to the admin as a user with valid credentials but no admin access permission now displays an error message, rather than rejecting the user silently + * Fix: StreamBlock HTML rendering now handles non-ASCII characters correctly on Python 2 (Mikalai Radchuk) 1.3.1 (05.01.2016) ~~~~~~~~~~~~~~~~~~ diff --git a/docs/releases/1.4.rst b/docs/releases/1.4.rst index 9ade13743a..cc77b5327f 100644 --- a/docs/releases/1.4.rst +++ b/docs/releases/1.4.rst @@ -80,6 +80,7 @@ Bug fixes * Ordering pages in the explorer by reverse 'last updated' time now puts pages with no revisions at the top * WagtailTestUtils now works correctly on custom user models without a ``username`` field (Adam Bolfik) * Logging in to the admin as a user with valid credentials but no admin access permission now displays an error message, rather than rejecting the user silently +* StreamBlock HTML rendering now handles non-ASCII characters correctly on Python 2 (Mikalai Radchuk) Upgrade considerations diff --git a/wagtail/wagtailcore/blocks/stream_block.py b/wagtail/wagtailcore/blocks/stream_block.py index 785d869d27..c4d0fc4fd8 100644 --- a/wagtail/wagtailcore/blocks/stream_block.py +++ b/wagtail/wagtailcore/blocks/stream_block.py @@ -307,7 +307,7 @@ class StreamValue(collections.Sequence): return repr(list(self)) def __html__(self): - return self.__str__() + return self.stream_block.render(self) def __str__(self): - return self.stream_block.render(self) + return self.__html__() diff --git a/wagtail/wagtailcore/tests/test_streamfield.py b/wagtail/wagtailcore/tests/test_streamfield.py index 57b4bbc73b..b80d5d6438 100644 --- a/wagtail/wagtailcore/tests/test_streamfield.py +++ b/wagtail/wagtailcore/tests/test_streamfield.py @@ -1,3 +1,6 @@ +# -*- coding: utf-8 -* +from __future__ import unicode_literals + import json from django.apps import apps @@ -141,12 +144,14 @@ class TestStreamFieldRenderingBase(TestCase): self.instance = StreamModel.objects.create(body=json.dumps([ {'type': 'rich_text', 'value': '
Rich text
'}, + {'type': 'rich_text', 'value': 'Привет, Микола
'}, {'type': 'image', 'value': self.image.pk}, {'type': 'text', 'value': 'Hello, World!'}])) img_tag = self.image.get_rendition('original').img_tag() self.expected = ''.join([ 'Rich text
Привет, Микола