mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Refs #23919 -- Removed re.U and re.UNICODE (default on Python 3).
This commit is contained in:
parent
990ce6386c
commit
c22212220a
7 changed files with 23 additions and 19 deletions
|
@ -19,8 +19,8 @@ def capfirst(x):
|
|||
|
||||
|
||||
# Set up regular expressions
|
||||
re_words = re.compile(r'<.*?>|((?:\w[-\w]*|&.*?;)+)', re.U | re.S)
|
||||
re_chars = re.compile(r'<.*?>|(.)', re.U | re.S)
|
||||
re_words = re.compile(r'<.*?>|((?:\w[-\w]*|&.*?;)+)', re.S)
|
||||
re_chars = re.compile(r'<.*?>|(.)', re.S)
|
||||
re_tag = re.compile(r'<(/)?([^ ]+?)(?:(\s*/)| .*?)?>', re.S)
|
||||
re_newlines = re.compile(r'\r\n|\r') # Used in normalize_newlines
|
||||
re_camel_case = re.compile(r'(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))')
|
||||
|
@ -417,8 +417,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, flags=re.U).strip().lower()
|
||||
return mark_safe(re.sub(r'[-\s]+', '-', value, flags=re.U))
|
||||
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')
|
||||
value = re.sub(r'[^\w\s-]', '', value).strip().lower()
|
||||
return mark_safe(re.sub(r'[-\s]+', '-', value))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue