diff options
| author | Ad Timmering <awtimmering@gmail.com> | 2021-11-26 10:44:54 +0900 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-01-07 12:25:06 +0100 |
| commit | bdf3e156b4b47d45b8e37823164b598afc533ce0 (patch) | |
| tree | e27b8a05d1fe76478e06e5114a4f4aa86a5942ab /django/utils | |
| parent | fe76944269c13d59f8bb3bc1cfff7ab6443777e4 (diff) | |
Fixed #28628 -- Changed \d to [0-9] in regexes where appropriate.
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/http.py | 10 | ||||
| -rw-r--r-- | django/utils/translation/trans_real.py | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/django/utils/http.py b/django/utils/http.py index 6aa45a2cd6..ab90f1e377 100644 --- a/django/utils/http.py +++ b/django/utils/http.py @@ -23,12 +23,12 @@ ETAG_MATCH = _lazy_re_compile(r''' ''', re.X) MONTHS = 'jan feb mar apr may jun jul aug sep oct nov dec'.split() -__D = r'(?P<day>\d{2})' -__D2 = r'(?P<day>[ \d]\d)' +__D = r'(?P<day>[0-9]{2})' +__D2 = r'(?P<day>[ 0-9][0-9])' __M = r'(?P<mon>\w{3})' -__Y = r'(?P<year>\d{4})' -__Y2 = r'(?P<year>\d{2})' -__T = r'(?P<hour>\d{2}):(?P<min>\d{2}):(?P<sec>\d{2})' +__Y = r'(?P<year>[0-9]{4})' +__Y2 = r'(?P<year>[0-9]{2})' +__T = r'(?P<hour>[0-9]{2}):(?P<min>[0-9]{2}):(?P<sec>[0-9]{2})' RFC1123_DATE = _lazy_re_compile(r'^\w{3}, %s %s %s %s GMT$' % (__D, __M, __Y, __T)) RFC850_DATE = _lazy_re_compile(r'^\w{6,9}, %s-%s-%s %s GMT$' % (__D, __M, __Y2, __T)) ASCTIME_DATE = _lazy_re_compile(r'^\w{3} %s %s %s %s$' % (__M, __D2, __T, __Y)) diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py index 7c20f5f32b..7a6bc81406 100644 --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -33,9 +33,9 @@ CONTEXT_SEPARATOR = "\x04" # Format of Accept-Language header values. From RFC 2616, section 14.4 and 3.9 # and RFC 3066, section 2.1 accept_language_re = _lazy_re_compile(r''' - ([A-Za-z]{1,8}(?:-[A-Za-z0-9]{1,8})*|\*) # "en", "en-au", "x-y-z", "es-419", "*" - (?:\s*;\s*q=(0(?:\.\d{,3})?|1(?:\.0{,3})?))? # Optional "q=1.00", "q=0.8" - (?:\s*,\s*|$) # Multiple accepts per header. + ([A-Za-z]{1,8}(?:-[A-Za-z0-9]{1,8})*|\*) # "en", "en-au", "x-y-z", "es-419", "*" + (?:\s*;\s*q=(0(?:\.[0-9]{,3})?|1(?:\.0{,3})?))? # Optional "q=1.00", "q=0.8" + (?:\s*,\s*|$) # Multiple accepts per header. ''', re.VERBOSE) language_code_re = _lazy_re_compile( |
