1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Removed module-level functions for the app cache.

Since the original ones in django.db.models.loading were kept only for
backwards compatibility, there's no need to recreate them. However, many
internals of Django still relied on them.

They were also imported in django.db.models. They never appear in the
documentation, except a quick mention of get_models and get_app in the
1.2 release notes to document an edge case in GIS. I don't think that
makes them a public API.

This commit doesn't change the overall amount of global state but
clarifies that it's tied to the app_cache object instead of hiding it
behind half a dozen functions.
This commit is contained in:
Aymeric Augustin
2013-12-11 23:31:34 +01:00
parent 334551339d
commit 8662654d6d
55 changed files with 226 additions and 220 deletions

View File

@@ -80,13 +80,13 @@ def get_test_modules():
def get_installed():
from django.apps.cache import get_apps
return [app.__name__.rsplit('.', 1)[0] for app in get_apps()]
from django.apps import app_cache
return [app.__name__.rsplit('.', 1)[0] for app in app_cache.get_apps()]
def setup(verbosity, test_labels):
import django
from django.apps.cache import get_apps, load_app
from django.apps import app_cache
from django.conf import settings
from django.test import TransactionTestCase, TestCase
@@ -128,7 +128,7 @@ def setup(verbosity, test_labels):
# Load all the ALWAYS_INSTALLED_APPS.
with warnings.catch_warnings():
warnings.filterwarnings('ignore', 'django.contrib.comments is deprecated and will be removed before Django 1.8.', DeprecationWarning)
get_apps()
app_cache.get_apps()
# Load all the test model apps.
test_modules = get_test_modules()
@@ -164,7 +164,7 @@ def setup(verbosity, test_labels):
if module_found_in_labels:
if verbosity >= 2:
print("Importing application %s" % module_name)
mod = load_app(module_label)
mod = app_cache.load_app(module_label)
if mod:
if module_label not in settings.INSTALLED_APPS:
settings.INSTALLED_APPS.append(module_label)