diff --git a/django/utils/regex_helper.py b/django/utils/regex_helper.py index 9e57ff8f15..b06acb0191 100644 --- a/django/utils/regex_helper.py +++ b/django/utils/regex_helper.py @@ -5,10 +5,6 @@ Used internally by Django and not intended for external use. This is not, and is not intended to be, a complete reg-exp decompiler. It should be good enough for a large class of URLS, however. """ -import warnings - -from django.utils.deprecation import RemovedInDjango21Warning - # Mapping of an escape character to a representative of that class. So, e.g., # "\w" is replaced by "x" in a reverse URL. A value of None means to ignore # this sequence. Any missing key is mapped to itself. @@ -121,12 +117,6 @@ def normalize(pattern): # All of these are ignorable. Walk to the end of the # group. walk_to_end(ch, pattern_iter) - elif ch in 'iLmsu#': - warnings.warn( - 'Using (?%s) in url() patterns is deprecated.' % ch, - RemovedInDjango21Warning - ) - walk_to_end(ch, pattern_iter) elif ch == ':': # Non-capturing group non_capturing_groups.append(len(result)) diff --git a/docs/releases/2.1.txt b/docs/releases/2.1.txt index fd56560365..d4dbc8fc3a 100644 --- a/docs/releases/2.1.txt +++ b/docs/releases/2.1.txt @@ -256,3 +256,5 @@ how to remove usage of these features. ``django.utils.cache.patch_response_headers()`` no longer set ETags. * The ``Model._meta.has_auto_field`` attribute is removed. + +* Support for regular expression groups with ``iLmsu#`` in ``url()`` is removed. diff --git a/tests/urlpatterns_reverse/test_deprecated.py b/tests/urlpatterns_reverse/test_deprecated.py deleted file mode 100644 index c918dd5a17..0000000000 --- a/tests/urlpatterns_reverse/test_deprecated.py +++ /dev/null @@ -1,33 +0,0 @@ -import warnings - -from django.conf.urls import url -from django.test import SimpleTestCase, override_settings -from django.urls import reverse - -from .views import empty_view - -urlpatterns = [ - url(r'^(?i)CaseInsensitive/(\w+)', empty_view, name="insensitive"), - url(r'^(?i)test/2/?$', empty_view, name="test2"), -] - - -@override_settings(ROOT_URLCONF='urlpatterns_reverse.test_deprecated') -class URLPatternReverse(SimpleTestCase): - - def test_urlpattern_reverse(self): - test_data = ( - ('insensitive', '/CaseInsensitive/fred', ['fred'], {}), - ('test2', '/test/2', [], {}), - ) - with warnings.catch_warnings(record=True) as warns: - warnings.simplefilter('always') - warnings.filterwarnings( - 'ignore', 'Flags not at the start', - DeprecationWarning, module='django.urls.resolvers' - ) - for i, (name, expected, args, kwargs) in enumerate(test_data): - got = reverse(name, args=args, kwargs=kwargs) - self.assertEqual(got, expected) - msg = str(warns[i].message) - self.assertEqual(msg, 'Using (?i) in url() patterns is deprecated.') diff --git a/tests/utils_tests/test_regex_helper.py b/tests/utils_tests/test_regex_helper.py index 93383e1c1a..77bcd5bb35 100644 --- a/tests/utils_tests/test_regex_helper.py +++ b/tests/utils_tests/test_regex_helper.py @@ -1,5 +1,4 @@ import unittest -import warnings from django.utils import regex_helper @@ -23,16 +22,6 @@ class NormalizeTests(unittest.TestCase): result = regex_helper.normalize(pattern) self.assertEqual(result, expected) - def test_group_ignored(self): - pattern = r"(?i)(?L)(?m)(?s)(?u)(?#)" - expected = [('', [])] - with warnings.catch_warnings(record=True) as warns: - warnings.simplefilter('always') - result = regex_helper.normalize(pattern) - self.assertEqual(result, expected) - for i, char in enumerate('iLmsu#'): - self.assertEqual(str(warns[i].message), 'Using (?%s) in url() patterns is deprecated.' % char) - def test_group_noncapturing(self): pattern = r"(?:non-capturing)" expected = [('non-capturing', [])]