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
05c578bc
Kaydet (Commit)
05c578bc
authored
Eyl 27, 2018
tarafından
Paweł Kołodziej
Kaydeden (comit)
Tim Graham
Eyl 27, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29796 -- Added system check for STATICFILES_DIRS prefix ending with a slash.
üst
40c8ffad
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletion
+19
-1
finders.py
django/contrib/staticfiles/finders.py
+7
-1
checks.txt
docs/ref/checks.txt
+2
-0
test_checks.py
tests/staticfiles_tests/test_checks.py
+10
-0
No files found.
django/contrib/staticfiles/finders.py
Dosyayı görüntüle @
05c578bc
...
@@ -78,7 +78,13 @@ class FileSystemFinder(BaseFinder):
...
@@ -78,7 +78,13 @@ class FileSystemFinder(BaseFinder):
))
))
for
root
in
settings
.
STATICFILES_DIRS
:
for
root
in
settings
.
STATICFILES_DIRS
:
if
isinstance
(
root
,
(
list
,
tuple
)):
if
isinstance
(
root
,
(
list
,
tuple
)):
_
,
root
=
root
prefix
,
root
=
root
if
prefix
.
endswith
(
'/'
):
errors
.
append
(
Error
(
'The prefix
%
r in the STATICFILES_DIRS setting must '
'not end with a slash.'
%
prefix
,
id
=
'staticfiles.E003'
,
))
if
settings
.
STATIC_ROOT
and
os
.
path
.
abspath
(
settings
.
STATIC_ROOT
)
==
os
.
path
.
abspath
(
root
):
if
settings
.
STATIC_ROOT
and
os
.
path
.
abspath
(
settings
.
STATIC_ROOT
)
==
os
.
path
.
abspath
(
root
):
errors
.
append
(
Error
(
errors
.
append
(
Error
(
'The STATICFILES_DIRS setting should not contain the '
'The STATICFILES_DIRS setting should not contain the '
...
...
docs/ref/checks.txt
Dosyayı görüntüle @
05c578bc
...
@@ -731,3 +731,5 @@ configured:
...
@@ -731,3 +731,5 @@ configured:
or list.
or list.
* **staticfiles.E002**: The :setting:`STATICFILES_DIRS` setting should not
* **staticfiles.E002**: The :setting:`STATICFILES_DIRS` setting should not
contain the :setting:`STATIC_ROOT` setting.
contain the :setting:`STATIC_ROOT` setting.
* **staticfiles.E003**: The prefix ``<prefix>`` in the
:setting:`STATICFILES_DIRS` setting must not end with a slash.
tests/staticfiles_tests/test_checks.py
Dosyayı görüntüle @
05c578bc
...
@@ -75,3 +75,13 @@ class FindersCheckTests(SimpleTestCase):
...
@@ -75,3 +75,13 @@ class FindersCheckTests(SimpleTestCase):
id
=
'staticfiles.E002'
,
id
=
'staticfiles.E002'
,
)
)
])
])
@override_settings
(
STATICFILES_DIRS
=
[(
'prefix/'
,
'/fake/path'
)])
def
test_prefix_contains_trailing_slash
(
self
):
self
.
assertEqual
(
check_finders
(
None
),
[
Error
(
"The prefix 'prefix/' in the STATICFILES_DIRS setting must "
"not end with a slash."
,
id
=
'staticfiles.E003'
,
)
])
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