diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-23 10:37:34 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-23 21:37:56 +0100 |
| commit | da16bb30ff238aa4d59b4186d92ef5429d8d0045 (patch) | |
| tree | dfda0b750aa0d3a71c4751edcb7b86f3517e2b3f /django/apps/cache.py | |
| parent | 5241763c81b6afe1c0327ff7eb0d75c643f24ce0 (diff) | |
Dropped AppCache._empty, _with_app and _without_app.
It's now easier to achieve the same effect with modify_settings or
override_settings.
Diffstat (limited to 'django/apps/cache.py')
| -rw-r--r-- | django/apps/cache.py | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/django/apps/cache.py b/django/apps/cache.py index bdd7e98e22..bd412f1192 100644 --- a/django/apps/cache.py +++ b/django/apps/cache.py @@ -1,7 +1,6 @@ "Utilities for loading models and the modules that contain them." from collections import defaultdict, OrderedDict -from contextlib import contextmanager import os import sys import warnings @@ -350,61 +349,6 @@ class AppCache(object): """ self.app_configs = self.stored_app_configs.pop() - ### DANGEROUS METHODS ### (only used to preserve existing tests) - - def _begin_with_app(self, app_name): - # Returns an opaque value that can be passed to _end_with_app(). - app_config = AppConfig.create(app_name) - if app_config.label in self.app_configs: - return None - else: - app_config.import_models(self.all_models[app_config.label]) - self.app_configs[app_config.label] = app_config - return app_config - - def _end_with_app(self, app_config): - if app_config is not None: - del self.app_configs[app_config.label] - - @contextmanager - def _with_app(self, app_name): - app_config = self._begin_with_app(app_name) - try: - yield - finally: - self._end_with_app(app_config) - - def _begin_without_app(self, app_name): - # Returns an opaque value that can be passed to _end_without_app(). - return self.app_configs.pop(app_name.rpartition(".")[2], None) - - def _end_without_app(self, app_config): - if app_config is not None: - self.app_configs[app_config.label] = app_config - - @contextmanager - def _without_app(self, app_name): - app_config = self._begin_without_app(app_name) - try: - yield - finally: - self._end_without_app(app_config) - - def _begin_empty(self): - app_configs, self.app_configs = self.app_configs, OrderedDict() - return app_configs - - def _end_empty(self, app_configs): - self.app_configs = app_configs - - @contextmanager - def _empty(self): - app_configs = self._begin_empty() - try: - yield - finally: - self._end_empty(app_configs) - ### DEPRECATED METHODS GO BELOW THIS LINE ### def load_app(self, app_name): |
