summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2017-04-10 05:12:37 -0700
committerTim Graham <timograham@gmail.com>2017-04-10 08:12:37 -0400
commitb906c3db63deb5ee58ab91fe6a7144ff6f8b6300 (patch)
tree5a8aaeeab34e3c6a1aca77660cc8cbcd602078cc
parenteac396a5d08a2c7424cd897b54360531dc0ceae5 (diff)
Removed duplicate lines in slugify().
-rw-r--r--django/utils/text.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/django/utils/text.py b/django/utils/text.py
index 0336b3fe79..cd9e704ea1 100644
--- a/django/utils/text.py
+++ b/django/utils/text.py
@@ -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))