mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +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:
parent
334551339d
commit
8662654d6d
55 changed files with 226 additions and 220 deletions
|
@ -2,7 +2,7 @@ from __future__ import unicode_literals
|
|||
|
||||
import copy
|
||||
|
||||
from django.apps.cache import cache
|
||||
from django.apps import app_cache
|
||||
from django.conf import settings
|
||||
from django.db import connection
|
||||
from django.core.management.color import no_style
|
||||
|
@ -28,7 +28,7 @@ class TablespacesTests(TestCase):
|
|||
def setUp(self):
|
||||
# The unmanaged models need to be removed after the test in order to
|
||||
# prevent bad interactions with the flush operation in other tests.
|
||||
self.old_app_models = copy.deepcopy(cache.app_models)
|
||||
self.old_app_models = copy.deepcopy(app_cache.app_models)
|
||||
|
||||
for model in Article, Authors, Reviewers, Scientist:
|
||||
model._meta.managed = True
|
||||
|
@ -37,8 +37,8 @@ class TablespacesTests(TestCase):
|
|||
for model in Article, Authors, Reviewers, Scientist:
|
||||
model._meta.managed = False
|
||||
|
||||
cache.app_models = self.old_app_models
|
||||
cache._get_models_cache = {}
|
||||
app_cache.app_models = self.old_app_models
|
||||
app_cache._get_models_cache = {}
|
||||
|
||||
def assertNumContains(self, haystack, needle, count):
|
||||
real_count = haystack.count(needle)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue