Removed duplicate lines in slugify().

This commit is contained in:
Jon Dufresne 2017-04-10 05:12:37 -07:00 committed by Tim Graham
parent eac396a5d0
commit b906c3db63
1 changed files with 2 additions and 3 deletions

View File

@ -412,9 +412,8 @@ def slugify(value, allow_unicode=False):
value = force_text(value)
if allow_unicode:
value = unicodedata.normalize('NFKC', value)
value = re.sub(r'[^\w\s-]', '', value).strip().lower()
return mark_safe(re.sub(r'[-\s]+', '-', value))
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore').decode('ascii')
else:
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore').decode('ascii')
value = re.sub(r'[^\w\s-]', '', value).strip().lower()
return mark_safe(re.sub(r'[-\s]+', '-', value))