mirror of
https://github.com/django/django.git
synced 2025-11-14 17:32:38 +00:00
Fixed #9323 -- Allow glob loading in INSTALLED_APPS to handle digits in names.
Patch from carljm. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9994 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
d8fdf4d7ac
commit
242fc60520
8 changed files with 25 additions and 1 deletions
|
|
@ -92,7 +92,7 @@ class Settings(object):
|
||||||
app_subdirs = os.listdir(appdir)
|
app_subdirs = os.listdir(appdir)
|
||||||
app_subdirs.sort()
|
app_subdirs.sort()
|
||||||
for d in app_subdirs:
|
for d in app_subdirs:
|
||||||
if d.isalpha() and os.path.isdir(os.path.join(appdir, d)):
|
if d.isalnum() and d[0].isalpha() and os.path.isdir(os.path.join(appdir, d)):
|
||||||
new_installed_apps.append('%s.%s' % (app[:-2], d))
|
new_installed_apps.append('%s.%s' % (app[:-2], d))
|
||||||
else:
|
else:
|
||||||
new_installed_apps.append(app)
|
new_installed_apps.append(app)
|
||||||
|
|
|
||||||
0
tests/regressiontests/app_loading/__init__.py
Normal file
0
tests/regressiontests/app_loading/__init__.py
Normal file
0
tests/regressiontests/app_loading/models.py
Normal file
0
tests/regressiontests/app_loading/models.py
Normal file
1
tests/regressiontests/app_loading/parent/__init__.py
Normal file
1
tests/regressiontests/app_loading/parent/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
# not empty to make SVN happy
|
||||||
1
tests/regressiontests/app_loading/parent/app/__init__.py
Normal file
1
tests/regressiontests/app_loading/parent/app/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
# not empty to make SVN happy
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
# not empty to make SVN happy
|
||||||
3
tests/regressiontests/app_loading/test_settings.py
Normal file
3
tests/regressiontests/app_loading/test_settings.py
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
INSTALLED_APPS = (
|
||||||
|
'parent.*',
|
||||||
|
)
|
||||||
18
tests/regressiontests/app_loading/tests.py
Normal file
18
tests/regressiontests/app_loading/tests.py
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
"""
|
||||||
|
Test the globbing of INSTALLED_APPS.
|
||||||
|
|
||||||
|
>>> import os, sys
|
||||||
|
>>> old_sys_path = sys.path
|
||||||
|
>>> sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
|
>>> from django.conf import Settings
|
||||||
|
|
||||||
|
>>> s = Settings('test_settings')
|
||||||
|
|
||||||
|
>>> s.INSTALLED_APPS
|
||||||
|
['parent.app', 'parent.app1']
|
||||||
|
|
||||||
|
>>> sys.path = old_sys_path
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue