From 7969c1ba05ef342725083d060b038a8a874e69e6 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sat, 18 Aug 2007 04:16:04 +0000 Subject: [PATCH] Renamed Cache to AppCache and cache_ready() to app_cache_ready() from [5919] in order to avoid any potential confusion with Django's caching middleware functionality when reading the code. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5922 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/loading.py | 10 +++++----- django/db/models/options.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/django/db/models/loading.py b/django/db/models/loading.py index dc8e903c45..090390aa9e 100644 --- a/django/db/models/loading.py +++ b/django/db/models/loading.py @@ -7,9 +7,9 @@ import os import threading __all__ = ('get_apps', 'get_app', 'get_models', 'get_model', 'register_models', - 'load_app', 'cache_ready') + 'load_app', 'app_cache_ready') -class Cache(object): +class AppCache(object): """ A cache that stores installed applications and their models. Used to provide reverse-relations and for app introspection (e.g. admin). @@ -85,7 +85,7 @@ class Cache(object): self.app_store[mod.models] = len(self.app_store) return mod.models - def cache_ready(self): + def app_cache_ready(self): """ Returns true if the model cache is fully populated. @@ -177,7 +177,7 @@ class Cache(object): continue model_dict[model_name] = model -cache = Cache() +cache = AppCache() # These methods were always module level, so are kept that way for backwards # compatibility. @@ -188,4 +188,4 @@ get_models = cache.get_models get_model = cache.get_model register_models = cache.register_models load_app = cache.load_app -cache_ready = cache.cache_ready +app_cache_ready = cache.app_cache_ready diff --git a/django/db/models/options.py b/django/db/models/options.py index 499da1eb01..8cd9b58ec8 100644 --- a/django/db/models/options.py +++ b/django/db/models/options.py @@ -2,7 +2,7 @@ from django.conf import settings from django.db.models.related import RelatedObject from django.db.models.fields.related import ManyToManyRel from django.db.models.fields import AutoField, FieldDoesNotExist -from django.db.models.loading import get_models, cache_ready +from django.db.models.loading import get_models, app_cache_ready from django.db.models.query import orderlist2sql from django.db.models import Manager from django.utils.translation import activate, deactivate_all, get_language, string_concat @@ -179,7 +179,7 @@ class Options(object): for f in klass._meta.many_to_many: if f.rel and self == f.rel.to._meta: rel_objs.append(RelatedObject(f.rel.to, klass, f)) - if cache_ready(): + if app_cache_ready(): self._all_related_many_to_many_objects = rel_objs return rel_objs