From 8662654d6d50e4d89f771a757ae5fc83c6b74db0 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Wed, 11 Dec 2013 23:31:34 +0100 Subject: 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. --- tests/managers_regress/tests.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tests/managers_regress') diff --git a/tests/managers_regress/tests.py b/tests/managers_regress/tests.py index 25717f7431..de9f72c333 100644 --- a/tests/managers_regress/tests.py +++ b/tests/managers_regress/tests.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals import copy -from django.apps.cache import cache +from django.apps import app_cache from django.db import models from django.template import Context, Template from django.test import TestCase @@ -114,7 +114,7 @@ class ManagersRegressionTests(TestCase): # This test adds dummy models to the app cache. These # need to be removed in order to prevent bad interactions # with the flush operation in other tests. - old_app_models = copy.deepcopy(cache.app_models) + old_app_models = copy.deepcopy(app_cache.app_models) class SwappableModel(models.Model): class Meta: @@ -129,7 +129,7 @@ class ManagersRegressionTests(TestCase): self.assertEqual(str(e), "Manager isn't available; SwappableModel has been swapped for 'managers_regress.Parent'") finally: - cache.app_models = old_app_models + app_cache.app_models = old_app_models @override_settings(TEST_SWAPPABLE_MODEL='managers_regress.Parent') def test_custom_swappable_manager(self): @@ -137,7 +137,7 @@ class ManagersRegressionTests(TestCase): # This test adds dummy models to the app cache. These # need to be removed in order to prevent bad interactions # with the flush operation in other tests. - old_app_models = copy.deepcopy(cache.app_models) + old_app_models = copy.deepcopy(app_cache.app_models) class SwappableModel(models.Model): @@ -156,7 +156,7 @@ class ManagersRegressionTests(TestCase): self.assertEqual(str(e), "Manager isn't available; SwappableModel has been swapped for 'managers_regress.Parent'") finally: - cache.app_models = old_app_models + app_cache.app_models = old_app_models @override_settings(TEST_SWAPPABLE_MODEL='managers_regress.Parent') def test_explicit_swappable_manager(self): @@ -164,7 +164,7 @@ class ManagersRegressionTests(TestCase): # This test adds dummy models to the app cache. These # need to be removed in order to prevent bad interactions # with the flush operation in other tests. - old_app_models = copy.deepcopy(cache.app_models) + old_app_models = copy.deepcopy(app_cache.app_models) class SwappableModel(models.Model): @@ -183,7 +183,7 @@ class ManagersRegressionTests(TestCase): self.assertEqual(str(e), "Manager isn't available; SwappableModel has been swapped for 'managers_regress.Parent'") finally: - cache.app_models = old_app_models + app_cache.app_models = old_app_models def test_regress_3871(self): related = RelatedModel.objects.create() -- cgit v1.2.1