From ff03186a2c758f3066c41effd36d4d2a25e1270d Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Fri, 28 Jun 2019 23:26:29 -0400 Subject: [PATCH] Remove the INSTALLED_APPS setting The INSTALLED APPS setting is now replaced by the new COMMON_EXTRA_APPS and COMMON_DISABLED_APPS. Exposing the INSTALLED_APPS setting had the side effect of blocking new apps that were added in new versions. Signed-off-by: Roberto Rosario --- HISTORY.rst | 2 ++ docs/releases/3.2.4.rst | 2 ++ mayan/apps/common/settings.py | 30 ++++++++++++++++++++---------- mayan/settings/base.py | 11 +++++++++++ 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 450d1aac3b..b8061c8540 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -18,6 +18,8 @@ existing tags. * Add proper redirection after moving a document to the trash. +* Remove the INSTALLED_APPS setting. Replace it with + the new COMMON_EXTRA_APPS and COMMON_DISABLED_APPS. 3.2.3 (2019-06-21) ================== diff --git a/docs/releases/3.2.4.rst b/docs/releases/3.2.4.rst index 8c33c8b0f2..8abc58cbc3 100644 --- a/docs/releases/3.2.4.rst +++ b/docs/releases/3.2.4.rst @@ -32,6 +32,8 @@ Changes existing tags. - Add proper redirection after moving a document to the trash. +- Remove the INSTALLED_APPS setting. Replace it with + the new COMMON_EXTRA_APPS and COMMON_DISABLED_APPS. Removals -------- diff --git a/mayan/apps/common/settings.py b/mayan/apps/common/settings.py index e838c07a65..841549b38f 100644 --- a/mayan/apps/common/settings.py +++ b/mayan/apps/common/settings.py @@ -26,6 +26,26 @@ settings_db_sync_task_delay = namespace.add_setting( 'propagate.' ) ) +setting_disabled_apps = namespace.add_setting( + global_name='COMMON_DISABLED_APPS', + default=settings.COMMON_DISABLED_APPS, + help_text=_( + 'A list of strings designating all applications that are to be removed ' + 'from the list normally installed by Mayan EDMS. Each string should be ' + 'a dotted Python path to: an application configuration class (preferred), ' + 'or a package containing an application.' + ), +) +setting_extra_apps = namespace.add_setting( + global_name='COMMON_EXTRA_APPS', + default=settings.COMMON_EXTRA_APPS, + help_text=_( + 'A list of strings designating all applications that are installed ' + 'beyond those normally installed by Mayan EDMS. Each string should be ' + 'a dotted Python path to: an application configuration class (preferred), ' + 'or a package containing an application.' + ), +) setting_home_view = namespace.add_setting( global_name='COMMON_HOME_VIEW', default=DEFAULT_COMMON_HOME_VIEW, help_text=_( @@ -254,16 +274,6 @@ setting_django_file_upload_max_memory_size = namespace.add_setting( 'DATA_UPLOAD_MAX_MEMORY_SIZE.' ), ) -setting_django_installed_apps = namespace.add_setting( - global_name='INSTALLED_APPS', - default=settings.INSTALLED_APPS, - help_text=_( - 'A list of strings designating all applications that are enabled ' - 'in this Django installation. Each string should be a dotted ' - 'Python path to: an application configuration class (preferred), ' - 'or a package containing an application.' - ), -) setting_django_login_url = namespace.add_setting( global_name='LOGIN_URL', default=settings.LOGIN_URL, diff --git a/mayan/settings/base.py b/mayan/settings/base.py index f2cd8f833b..3a3f2783d9 100644 --- a/mayan/settings/base.py +++ b/mayan/settings/base.py @@ -358,6 +358,8 @@ else: BASE_INSTALLED_APPS = INSTALLED_APPS +COMMON_EXTRA_APPS = () +COMMON_DISABLED_APPS = () CONFIGURATION_FILEPATH = os.path.join(MEDIA_ROOT, CONFIGURATION_FILENAME) CONFIGURATION_LAST_GOOD_FILEPATH = os.path.join( @@ -376,3 +378,12 @@ for app in INSTALLED_APPS: 'Update the app references in the file config.yml as detailed ' 'in https://docs.mayan-edms.com/releases/3.2.html#backward-incompatible-changes' ) + + +for APP in COMMON_EXTRA_APPS: + INSTALLED_APPS = INSTALLED_APPS + (APP,) + + +INSTALLED_APPS = [ + APP for APP in INSTALLED_APPS if APP not in COMMON_DISABLED_APPS +]