From 50c46fd9d91be5c4a2a236847f55b970b9e8b310 Mon Sep 17 00:00:00 2001 From: bmedx Date: Wed, 6 Jun 2018 16:27:31 -0400 Subject: [PATCH] Remove now-unused django_db_models_options.py Code that actually used it was removed in this commit: https://github.com/edx/edx-platform/commit/26b4e30833b0410d0131c5e7bfa40b6f418ae135#diff-8d36006736e42cad141490ae17f58a89 --- .../monkey_patch/django_db_models_options.py | 39 ------------------- 1 file changed, 39 deletions(-) delete mode 100644 openedx/core/djangoapps/monkey_patch/django_db_models_options.py diff --git a/openedx/core/djangoapps/monkey_patch/django_db_models_options.py b/openedx/core/djangoapps/monkey_patch/django_db_models_options.py deleted file mode 100644 index d67373b3f9..0000000000 --- a/openedx/core/djangoapps/monkey_patch/django_db_models_options.py +++ /dev/null @@ -1,39 +0,0 @@ -""" -Monkey patch implementation of the following _expire_cache performance improvement: - -https://github.com/django/django/commit/7628f87e2b1ab4b8a881f06c8973be4c368aaa3d - -Remove once we upgrade to a version of django which includes this fix natively! -NOTE: This is on django's master branch but is NOT currently part of any django 1.8 or 1.9 release. -""" - -from django.db.models.options import Options - - -def patch(): - """ - Monkey-patch the Options class. - """ - def _expire_cache(self, forward=True, reverse=True): - # pylint: disable=missing-docstring - - # This method is usually called by apps.cache_clear(), when the - # registry is finalized, or when a new field is added. - if forward: - for cache_key in self.FORWARD_PROPERTIES: - if cache_key in self.__dict__: - delattr(self, cache_key) - if reverse and not self.abstract: - for cache_key in self.REVERSE_PROPERTIES: - if cache_key in self.__dict__: - delattr(self, cache_key) - self._get_fields_cache = {} # pylint: disable=protected-access - - # Patch constants as a set instead of a list. - Options.FORWARD_PROPERTIES = {'fields', 'many_to_many', 'concrete_fields', - 'local_concrete_fields', '_forward_fields_map'} - - Options.REVERSE_PROPERTIES = {'related_objects', 'fields_map', '_relation_tree'} - - # Patch the expire_cache method to utilize constant's new set data structure. - Options._expire_cache = _expire_cache # pylint: disable=protected-access