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

@ -1,4 +1,4 @@
from django.apps.cache import get_app
from django.apps import app_cache
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.test.utils import override_settings
@ -33,4 +33,4 @@ class NoModelTests(TestCase):
def test_no_models(self):
with six.assertRaisesRegex(self, ImproperlyConfigured,
'App with label no_models is missing a models.py module.'):
get_app('no_models')
app_cache.get_app('no_models')