1
0
mirror of https://github.com/django/django.git synced 2025-07-03 01:09:12 +00:00

magic-removal: Changed usage of __import__() in order to fix some obscure bugs caused by reloading of model classes.

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2489 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Luke Plant 2006-03-06 19:32:49 +00:00
parent 6e82705741
commit 15f52f0c5b

View File

@ -17,7 +17,7 @@ def get_apps():
_app_list = []
for app_name in settings.INSTALLED_APPS:
try:
_app_list.append(__import__(app_name + '.models', '', '', ['']))
_app_list.append(__import__(app_name, '', '', ['models']).models)
except ImportError, e:
pass
return _app_list
@ -26,7 +26,7 @@ def get_app(app_label):
"Returns the module containing the models for the given app_label."
for app_name in settings.INSTALLED_APPS:
if app_label == app_name.split('.')[-1]:
return __import__('%s.models' % app_name, '', '', [''])
return __import__(app_name, '', '', ['models']).models
raise ImproperlyConfigured, "App with label %s could not be found" % app_label
def get_models(app_mod=None):