mirror of
https://github.com/django/django.git
synced 2025-09-14 22:45:45 +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
|
@ -1,7 +1,8 @@
|
|||
from importlib import import_module
|
||||
import os
|
||||
import sys
|
||||
from importlib import import_module
|
||||
from django.apps.cache import cache
|
||||
|
||||
from django.apps import app_cache
|
||||
from django.db.migrations.recorder import MigrationRecorder
|
||||
from django.db.migrations.graph import MigrationGraph
|
||||
from django.utils import six
|
||||
|
@ -45,7 +46,7 @@ class MigrationLoader(object):
|
|||
if app_label in settings.MIGRATION_MODULES:
|
||||
return settings.MIGRATION_MODULES[app_label]
|
||||
else:
|
||||
return '%s.migrations' % cache.get_app_package(app_label)
|
||||
return '%s.migrations' % app_cache.get_app_package(app_label)
|
||||
|
||||
def load_disk(self):
|
||||
"""
|
||||
|
@ -54,7 +55,7 @@ class MigrationLoader(object):
|
|||
self.disk_migrations = {}
|
||||
self.unmigrated_apps = set()
|
||||
self.migrated_apps = set()
|
||||
for app in cache.get_apps():
|
||||
for app in app_cache.get_apps():
|
||||
# Get the migrations module directory
|
||||
app_label = app.__name__.split(".")[-2]
|
||||
module_name = self.migrations_module(app_label)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue