diff --git a/mayan/apps/platform/management/commands/platformtemplate.py b/mayan/apps/platform/management/commands/platformtemplate.py index f830c4177b..b0fa5ceb48 100644 --- a/mayan/apps/platform/management/commands/platformtemplate.py +++ b/mayan/apps/platform/management/commands/platformtemplate.py @@ -40,8 +40,11 @@ class Command(management.BaseCommand): ) exit(1) else: + # Python 2 & 3 way to convert from SafeString to unicode self.stdout.write( - template().render( - context_string=options.get('context') + '{}'.format( + template().render( + context_string=options.get('context') + ) ) ) diff --git a/mayan/apps/platform/tests/test_management_commands.py b/mayan/apps/platform/tests/test_management_commands.py index aaae5a364f..bf83def325 100644 --- a/mayan/apps/platform/tests/test_management_commands.py +++ b/mayan/apps/platform/tests/test_management_commands.py @@ -1,6 +1,6 @@ from __future__ import unicode_literals -from io import BytesIO +from django.utils.six import StringIO from django.core import management from django.test import TestCase @@ -38,7 +38,7 @@ PlatformTemplate.register(klass=TestPlatformTemplate) class PlatformTemplateManagementCommandTestCase(TestCase): def test_platform_template_simple(self): - output = BytesIO() + output = StringIO() args = (TEST_TEMPLATE_NAME,) options = { 'stdout': output @@ -47,7 +47,7 @@ class PlatformTemplateManagementCommandTestCase(TestCase): self.assertEqual(output.getvalue(), TEST_TEMPLATE_STRING_RENDER) def test_platform_template_context(self): - output = BytesIO() + output = StringIO() args = ( TEST_TEMPLATE_NAME, '--context', 'test_template_variable: {}'.format(