Loading django/apps/cache.py +7 −7 Original line number Diff line number Diff line Loading @@ -60,11 +60,11 @@ class BaseAppCache(object): def __init__(self): self.__dict__ = _initialize() # This stops _populate loading from INSTALLED_APPS and ignores the # This stops populate loading from INSTALLED_APPS and ignores the # only_installed arguments to get_model[s] self.loads_installed = False def _populate(self): def populate(self): """ Fill in all the cache information. This method is threadsafe, in the sense that every caller will see the same state upon return, and if the Loading Loading @@ -161,7 +161,7 @@ class BaseAppCache(object): If only_installed is True (default), only applications explicitly listed in INSTALLED_APPS are considered. """ self._populate() self.populate() for app_config in self.app_configs.values(): if only_installed and not app_config.installed: continue Loading @@ -181,7 +181,7 @@ class BaseAppCache(object): If only_installed is True (default), only applications explicitly listed in INSTALLED_APPS are considered. """ self._populate() self.populate() app_config = self.app_configs.get(app_label) if app_config is None or (only_installed and not app_config.installed): raise LookupError("No app with label %r." % app_label) Loading Loading @@ -246,7 +246,7 @@ class BaseAppCache(object): return model_list except KeyError: pass self._populate() self.populate() if app_mod: app_label = self._label_for(app_mod) try: Loading Loading @@ -289,7 +289,7 @@ class BaseAppCache(object): if not self.loads_installed: only_installed = False if seed_cache: self._populate() self.populate() if only_installed: app_config = self.app_configs.get(app_label) if app_config is not None and not app_config.installed: Loading Loading @@ -371,7 +371,7 @@ class BaseAppCache(object): "[a.path for a in get_app_configs()] supersedes get_app_paths().", PendingDeprecationWarning, stacklevel=2) self._populate() self.populate() app_paths = [] for app in self.get_apps(): Loading django/contrib/admin/validation.py +3 −3 Original line number Diff line number Diff line Loading @@ -16,9 +16,9 @@ __all__ = ['BaseValidator', 'InlineValidator'] class BaseValidator(object): def __init__(self): # Before we can introspect models, they need to be fully loaded so that # inter-relations are set up correctly. We force that here. app_cache.get_apps() # Before we can introspect models, they need the app cache to be fully # loaded so that inter-relations are set up correctly. app_cache.populate() def validate(self, cls, model): for m in dir(self): Loading django/core/serializers/base.py +3 −4 Original line number Diff line number Diff line Loading @@ -137,10 +137,9 @@ class Deserializer(six.Iterator): self.stream = six.StringIO(stream_or_string) else: self.stream = stream_or_string # hack to make sure that the models have all been loaded before # deserialization starts (otherwise subclass calls to get_model() # and friends might fail...) app_cache.get_apps() # Make sure the app cache is loaded before deserialization starts # (otherwise subclass calls to get_model() and friends might fail...) app_cache.populate() def __iter__(self): return self Loading django/core/serializers/python.py +2 −1 Original line number Diff line number Diff line Loading @@ -88,7 +88,8 @@ def Deserializer(object_list, **options): db = options.pop('using', DEFAULT_DB_ALIAS) ignore = options.pop('ignorenonexistent', False) app_cache.get_apps() app_cache.populate() for d in object_list: # Look up the model and starting build a dict of data for it. Model = _get_model(d["model"]) Loading django/db/models/loading.py +1 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,6 @@ def get_app_errors(): try: return app_cache.app_errors except AttributeError: app_cache._populate() app_cache.populate() app_cache.app_errors = {} return app_cache.app_errors Loading
django/apps/cache.py +7 −7 Original line number Diff line number Diff line Loading @@ -60,11 +60,11 @@ class BaseAppCache(object): def __init__(self): self.__dict__ = _initialize() # This stops _populate loading from INSTALLED_APPS and ignores the # This stops populate loading from INSTALLED_APPS and ignores the # only_installed arguments to get_model[s] self.loads_installed = False def _populate(self): def populate(self): """ Fill in all the cache information. This method is threadsafe, in the sense that every caller will see the same state upon return, and if the Loading Loading @@ -161,7 +161,7 @@ class BaseAppCache(object): If only_installed is True (default), only applications explicitly listed in INSTALLED_APPS are considered. """ self._populate() self.populate() for app_config in self.app_configs.values(): if only_installed and not app_config.installed: continue Loading @@ -181,7 +181,7 @@ class BaseAppCache(object): If only_installed is True (default), only applications explicitly listed in INSTALLED_APPS are considered. """ self._populate() self.populate() app_config = self.app_configs.get(app_label) if app_config is None or (only_installed and not app_config.installed): raise LookupError("No app with label %r." % app_label) Loading Loading @@ -246,7 +246,7 @@ class BaseAppCache(object): return model_list except KeyError: pass self._populate() self.populate() if app_mod: app_label = self._label_for(app_mod) try: Loading Loading @@ -289,7 +289,7 @@ class BaseAppCache(object): if not self.loads_installed: only_installed = False if seed_cache: self._populate() self.populate() if only_installed: app_config = self.app_configs.get(app_label) if app_config is not None and not app_config.installed: Loading Loading @@ -371,7 +371,7 @@ class BaseAppCache(object): "[a.path for a in get_app_configs()] supersedes get_app_paths().", PendingDeprecationWarning, stacklevel=2) self._populate() self.populate() app_paths = [] for app in self.get_apps(): Loading
django/contrib/admin/validation.py +3 −3 Original line number Diff line number Diff line Loading @@ -16,9 +16,9 @@ __all__ = ['BaseValidator', 'InlineValidator'] class BaseValidator(object): def __init__(self): # Before we can introspect models, they need to be fully loaded so that # inter-relations are set up correctly. We force that here. app_cache.get_apps() # Before we can introspect models, they need the app cache to be fully # loaded so that inter-relations are set up correctly. app_cache.populate() def validate(self, cls, model): for m in dir(self): Loading
django/core/serializers/base.py +3 −4 Original line number Diff line number Diff line Loading @@ -137,10 +137,9 @@ class Deserializer(six.Iterator): self.stream = six.StringIO(stream_or_string) else: self.stream = stream_or_string # hack to make sure that the models have all been loaded before # deserialization starts (otherwise subclass calls to get_model() # and friends might fail...) app_cache.get_apps() # Make sure the app cache is loaded before deserialization starts # (otherwise subclass calls to get_model() and friends might fail...) app_cache.populate() def __iter__(self): return self Loading
django/core/serializers/python.py +2 −1 Original line number Diff line number Diff line Loading @@ -88,7 +88,8 @@ def Deserializer(object_list, **options): db = options.pop('using', DEFAULT_DB_ALIAS) ignore = options.pop('ignorenonexistent', False) app_cache.get_apps() app_cache.populate() for d in object_list: # Look up the model and starting build a dict of data for it. Model = _get_model(d["model"]) Loading
django/db/models/loading.py +1 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,6 @@ def get_app_errors(): try: return app_cache.app_errors except AttributeError: app_cache._populate() app_cache.populate() app_cache.app_errors = {} return app_cache.app_errors