From 550ddc66b496473c8ee282c7ab6be5885a359d75 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Wed, 14 Nov 2012 10:50:15 +0100 Subject: Fixed #19272 -- Fixed gettext_lazy returned type on Python 2 Thanks tyrion for the report. --- django/utils/translation/trans_real.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'django/utils') diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py index 9e94840ee0..1bcef2d8de 100644 --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -246,7 +246,8 @@ def do_translate(message, translation_function): """ global _default - eol_message = message.replace('\r\n', '\n').replace('\r', '\n') + # str() is allowing a bytestring message to remain bytestring on Python 2 + eol_message = message.replace(str('\r\n'), str('\n')).replace(str('\r'), str('\n')) t = getattr(_active, "value", None) if t is not None: result = getattr(t, translation_function)(eol_message) -- cgit v1.3