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
2ac89012
Kaydet (Commit)
2ac89012
authored
Agu 07, 2013
tarafından
SusanTan
Kaydeden (comit)
Tim Graham
Agu 09, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #12288 -- Added unique validation for INSTALLED_APPS
üst
4fa2738f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
__init__.py
django/conf/__init__.py
+3
-0
tests.py
tests/settings_tests/tests.py
+21
-0
No files found.
django/conf/__init__.py
Dosyayı görüntüle @
2ac89012
...
...
@@ -107,6 +107,9 @@ class BaseSettings(object):
elif
name
==
"ALLOWED_INCLUDE_ROOTS"
and
isinstance
(
value
,
six
.
string_types
):
raise
ValueError
(
"The ALLOWED_INCLUDE_ROOTS setting must be set "
"to a tuple, not a string."
)
elif
name
==
"INSTALLED_APPS"
and
len
(
value
)
!=
len
(
set
(
value
)):
raise
ImproperlyConfigured
(
"The INSTALLED_APPS setting must contain unique values."
)
object
.
__setattr__
(
self
,
name
,
value
)
...
...
tests/settings_tests/tests.py
Dosyayı görüntüle @
2ac89012
...
...
@@ -226,6 +226,27 @@ class TestComplexSettingOverride(TestCase):
self
.
assertEqual
(
'Overriding setting TEST_WARN can lead to unexpected behaviour.'
,
str
(
w
[
-
1
]
.
message
))
class
UniqueSettngsTests
(
TestCase
):
"""
Tests for the INSTALLED_APPS setting.
"""
settings_module
=
settings
def
setUp
(
self
):
self
.
_installed_apps
=
self
.
settings_module
.
INSTALLED_APPS
def
tearDown
(
self
):
self
.
settings_module
.
INSTALLED_APPS
=
self
.
_installed_apps
def
test_unique
(
self
):
"""
An ImproperlyConfigured exception is raised if the INSTALLED_APPS contains
any duplicate strings.
"""
with
self
.
assertRaises
(
ImproperlyConfigured
):
self
.
settings_module
.
INSTALLED_APPS
=
(
"myApp1"
,
"myApp1"
,
"myApp2"
,
"myApp3"
)
class
TrailingSlashURLTests
(
TestCase
):
"""
Tests for the MEDIA_URL and STATIC_URL settings.
...
...
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