﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20231	django.utils.text.smart_strip does not work with lazy strings (TypeError)	Baptiste Mispelon	nobody	"{{{
#!python
>>> from django.utils.text import smart_split
>>> from django.utils.translation import ugettext_lazy as _
>>> smart_split(_('a b c d'))
<django.utils.functional.lazy.<locals>.__proxy__ object at 0x7f53e20b0e10>
>>> list(smart_split(_('a b c d')))
Traceback (most recent call last):
  File ""<stdin>"", line 1, in <module>
  File ""./django/utils/functional.py"", line 128, in __wrapper__
    raise TypeError(""Lazy object returned unexpected type."")
TypeError: Lazy object returned unexpected type.
}}}

This is caused by this line: https://github.com/django/django/blob/master/django/utils/text.py#L359

I don't think the `allow_lazy` decorator can be applied to a generator function so I think the line should be removed altogether.

If we remove the decorator, then lazy strings are evaluated when the generator is called.
This is not exactly backwards-incompatible since this function never actually worked with lazy strings in the first place."	Bug	closed	Utilities	dev	Normal	fixed			Accepted	1	0	0	0	0	0
