Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #12288 -- Validated that app names in INSTALLED_APPS are unique

  • Loading branch information...
commit c1ec08998d1b690855d5e69a1f4d9d2f01d44ae6 1 parent ad6fcdb
@e0ne e0ne authored timgraham committed
Showing with 7 additions and 3 deletions.
  1. +3 −2 django/conf/__init__.py
  2. +4 −1 tests/settings_tests/tests.py
View
5 django/conf/__init__.py
@@ -109,8 +109,9 @@ def __setattr__(self, name, value):
"to a tuple, not a string.")
elif name == "INSTALLED_APPS":
value = list(value) # force evaluation of generators on Python 3
- if len(value) != len(set(value)):
- raise ImproperlyConfigured("The INSTALLED_APPS setting must contain unique values.")
+ apps = [s.split('.')[-1] for s in value]
+ if len(value) != len(set(apps)):
+ raise ImproperlyConfigured("The INSTALLED_APPS setting must contain unique app names.")
object.__setattr__(self, name, value)
View
5 tests/settings_tests/tests.py
@@ -241,11 +241,14 @@ def tearDown(self):
def test_unique(self):
"""
An ImproperlyConfigured exception is raised if the INSTALLED_APPS contains
- any duplicate strings.
+ any duplicate appication names.
"""
with self.assertRaises(ImproperlyConfigured):
self.settings_module.INSTALLED_APPS = ("myApp1", "myApp1", "myApp2", "myApp3")
+ with self.assertRaises(ImproperlyConfigured):
+ self.settings_module.INSTALLED_APPS = ("package1.myApp1", "package2.myApp1")
+
class TrailingSlashURLTests(TestCase):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.