Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
ba42456c
Kaydet (Commit)
ba42456c
authored
Eyl 03, 2017
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #27648 -- Removed support for (iLmsu) regex groups in url() patterns.
Per deprecation timeline.
üst
5bcca2a0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
54 deletions
+2
-54
regex_helper.py
django/utils/regex_helper.py
+0
-10
2.1.txt
docs/releases/2.1.txt
+2
-0
test_deprecated.py
tests/urlpatterns_reverse/test_deprecated.py
+0
-33
test_regex_helper.py
tests/utils_tests/test_regex_helper.py
+0
-11
No files found.
django/utils/regex_helper.py
Dosyayı görüntüle @
ba42456c
...
@@ -5,10 +5,6 @@ Used internally by Django and not intended for external use.
...
@@ -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
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.
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.,
# 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
# "\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.
# this sequence. Any missing key is mapped to itself.
...
@@ -121,12 +117,6 @@ def normalize(pattern):
...
@@ -121,12 +117,6 @@ def normalize(pattern):
# All of these are ignorable. Walk to the end of the
# All of these are ignorable. Walk to the end of the
# group.
# group.
walk_to_end
(
ch
,
pattern_iter
)
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
==
':'
:
elif
ch
==
':'
:
# Non-capturing group
# Non-capturing group
non_capturing_groups
.
append
(
len
(
result
))
non_capturing_groups
.
append
(
len
(
result
))
...
...
docs/releases/2.1.txt
Dosyayı görüntüle @
ba42456c
...
@@ -256,3 +256,5 @@ how to remove usage of these features.
...
@@ -256,3 +256,5 @@ how to remove usage of these features.
``django.utils.cache.patch_response_headers()`` no longer set ETags.
``django.utils.cache.patch_response_headers()`` no longer set ETags.
* The ``Model._meta.has_auto_field`` attribute is removed.
* The ``Model._meta.has_auto_field`` attribute is removed.
* Support for regular expression groups with ``iLmsu#`` in ``url()`` is removed.
tests/urlpatterns_reverse/test_deprecated.py
deleted
100644 → 0
Dosyayı görüntüle @
5bcca2a0
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.'
)
tests/utils_tests/test_regex_helper.py
Dosyayı görüntüle @
ba42456c
import
unittest
import
unittest
import
warnings
from
django.utils
import
regex_helper
from
django.utils
import
regex_helper
...
@@ -23,16 +22,6 @@ class NormalizeTests(unittest.TestCase):
...
@@ -23,16 +22,6 @@ class NormalizeTests(unittest.TestCase):
result
=
regex_helper
.
normalize
(
pattern
)
result
=
regex_helper
.
normalize
(
pattern
)
self
.
assertEqual
(
result
,
expected
)
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
):
def
test_group_noncapturing
(
self
):
pattern
=
r"(?:non-capturing)"
pattern
=
r"(?:non-capturing)"
expected
=
[(
'non-capturing'
,
[])]
expected
=
[(
'non-capturing'
,
[])]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment