Changed allow_lazy to the @keep_lazy decorator.

- Legacy-Id: 14674
This commit is contained in:
Henrik Levkowetz 2018-02-22 00:13:32 +00:00
parent 8b6a71c804
commit 71a9ffafc5

View file

@ -11,6 +11,7 @@ from django.utils.safestring import mark_safe
import debug # pyflakes:ignore
@keep_lazy(six.text_type)
def xslugify(value):
"""
Converts to ASCII. Converts spaces to hyphens. Removes characters that
@ -21,7 +22,6 @@ def xslugify(value):
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore').decode('ascii')
value = re.sub('[^\w\s/-]', '', value).strip().lower()
return mark_safe(re.sub('[-\s/]+', '-', value))
xslugify = keep_lazy(xslugify, six.text_type)
def strip_prefix(text, prefix):
if text.startswith(prefix):