From 5071eb6fdadc80b53af9cc353b6d3bb6af207023 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Mon, 15 Apr 2019 15:34:24 -0400 Subject: [PATCH] Expose new Django settings Expose: AUTH_PASSWORD_VALIDATORS, DEFAULT_FROM_EMAIL, EMAIL_TIMEOUT, INTERNAL_IPS, LANGUAGES, LANGUAGE_CODE, STATIC_URL, STATICFILES_STORAGE, TIME_ZONE, WSGI_APPLICATION. Closes GitLab issue #539 "Setting for default email sender is missing" Signed-off-by: Roberto Rosario --- HISTORY.rst | 3 + docs/releases/3.2.rst | 4 ++ mayan/apps/common/settings.py | 107 ++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index fb0598c2df..c22f958a85 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -67,6 +67,9 @@ * Add docstrings to most models. * Add support to the mailing profiles for specifying a from address. Closes GitLab issue #522. +* Expose new Django settings: AUTH_PASSWORD_VALIDATORS, DEFAULT_FROM_EMAIL, + EMAIL_TIMEOUT, INTERNAL_IPS, LANGUAGES, LANGUAGE_CODE, STATIC_URL, + STATICFILES_STORAGE, TIME_ZONE, WSGI_APPLICATION. 3.1.11 (2019-04-XX) =================== diff --git a/docs/releases/3.2.rst b/docs/releases/3.2.rst index b627424499..03a1f6486f 100644 --- a/docs/releases/3.2.rst +++ b/docs/releases/3.2.rst @@ -99,6 +99,9 @@ Other changes * Add docstrings to most models. * Add support to the mailing profiles for specifying a from address. Closes GitLab issue #522. +* Expose new Django settings: AUTH_PASSWORD_VALIDATORS, DEFAULT_FROM_EMAIL, + EMAIL_TIMEOUT, INTERNAL_IPS, LANGUAGES, LANGUAGE_CODE, STATIC_URL, + STATICFILES_STORAGE, TIME_ZONE, WSGI_APPLICATION. Removals -------- @@ -170,6 +173,7 @@ Bugs fixed or issues closed * :gitlab-issue:`498` Can't scan subdirectories * :gitlab-issue:`522` Office 365 SMTP +* :gitlab-issue:`539` Setting for default email sender is missing * :gitlab-issue:`563` Recursive Watch Folder .. _PyPI: https://pypi.python.org/pypi/mayan-edms/ diff --git a/mayan/apps/common/settings.py b/mayan/apps/common/settings.py index 65bd08a330..1fa5e2152e 100644 --- a/mayan/apps/common/settings.py +++ b/mayan/apps/common/settings.py @@ -112,6 +112,14 @@ setting_django_append_slash = namespace.add_setting( 'PREPEND_WWW.' ) ) +setting_django_auth_password_validators = namespace.add_setting( + global_name='AUTH_PASSWORD_VALIDATORS', + default=settings.AUTH_PASSWORD_VALIDATORS, + help_text=_( + 'The list of validators that are used to check the strength of ' + 'user\'s passwords.' + ) +) setting_django_databases = namespace.add_setting( global_name='DATABASES', default=settings.DATABASES, help_text=_( @@ -143,6 +151,16 @@ setting_django_data_upload_max_memory_size = namespace.add_setting( 'FILE_UPLOAD_MAX_MEMORY_SIZE.' ), ) +setting_django_default_from_email = namespace.add_setting( + global_name='DEFAULT_FROM_EMAIL', + default=settings.DEFAULT_FROM_EMAIL, + help_text=_( + 'Default: \'webmaster@localhost\' ' + 'Default email address to use for various automated correspondence ' + 'from the site manager(s). This doesn\'t include error messages sent ' + 'to ADMINS and MANAGERS; for that, see SERVER_EMAIL.' + ), +) setting_django_disallowed_user_agents = namespace.add_setting( global_name='DISALLOWED_USER_AGENTS', default=settings.DISALLOWED_USER_AGENTS, @@ -196,6 +214,14 @@ setting_django_email_port = namespace.add_setting( 'Default: 25. Port to use for the SMTP server defined in EMAIL_HOST.' ), ) +setting_django_email_timeout = namespace.add_setting( + global_name='EMAIL_TIMEOUT', + default=settings.EMAIL_TIMEOUT, + help_text=_( + 'Default: None. Specifies a timeout in seconds for blocking ' + 'operations like the connection attempt.' + ), +) setting_django_email_user_tls = namespace.add_setting( global_name='EMAIL_USE_TLS', default=settings.EMAIL_USE_TLS, @@ -270,6 +296,87 @@ setting_django_login_redirect_url = namespace.add_setting( 'have to define the URL in two places (settings and URLconf).' ), ) +setting_django_internal_ips = namespace.add_setting( + global_name='INTERNAL_IPS', + default=settings.INTERNAL_IPS, + help_text=_( + 'A list of IP addresses, as strings, that: Allow the debug() ' + 'context processor to add some variables to the template context. ' + 'Can use the admindocs bookmarklets even if not logged in as a ' + 'staff user. Are marked as "internal" (as opposed to "EXTERNAL") ' + 'in AdminEmailHandler emails.' + ), +) +setting_django_languages = namespace.add_setting( + global_name='LANGUAGES', + default=settings.LANGUAGES, + help_text=_( + 'A list of all available languages. The list is a list of ' + 'two-tuples in the format (language code, language name) ' + 'for example, (\'ja\', \'Japanese\'). This specifies which ' + 'languages are available for language selection. ' + 'Generally, the default value should suffice. Only set this ' + 'setting if you want to restrict language selection to a ' + 'subset of the Django-provided languages. ' + ), +) +setting_django_language_code = namespace.add_setting( + global_name='LANGUAGE_CODE', + default=settings.LANGUAGE_CODE, + help_text=_( + 'A string representing the language code for this installation. ' + 'This should be in standard language ID format. For example, U.S. ' + 'English is "en-us". It serves two purposes: If the locale ' + 'middleware isn\'t in use, it decides which translation is served ' + 'to all users. If the locale middleware is active, it provides a ' + 'fallback language in case the user\'s preferred language can\'t ' + 'be determined or is not supported by the website. It also provides ' + 'the fallback translation when a translation for a given literal ' + 'doesn\'t exist for the user\'s preferred language.' + ), +) +setting_django_static_url = namespace.add_setting( + global_name='STATIC_URL', + default=settings.STATIC_URL, + help_text=_( + 'URL to use when referring to static files located in STATIC_ROOT. ' + 'Example: "/static/" or "http://static.example.com/" ' + 'If not None, this will be used as the base path for asset ' + 'definitions (the Media class) and the staticfiles app.' + 'It must end in a slash if set to a non-empty value.' + ), +) +setting_django_staticfiles_storage = namespace.add_setting( + global_name='STATICFILES_STORAGE', + default=settings.STATICFILES_STORAGE, + help_text=_( + 'The file storage engine to use when collecting static files with ' + 'the collectstatic management command. A ready-to-use instance of ' + 'the storage backend defined in this setting can be found at ' + 'django.contrib.staticfiles.storage.staticfiles_storage.' + ), +) +setting_django_time_zone = namespace.add_setting( + global_name='TIME_ZONE', + default=settings.TIME_ZONE, + help_text=_( + 'A string representing the time zone for this installation. ' + 'Note that this isn\'t necessarily the time zone of the server. ' + 'For example, one server may serve multiple Django-powered sites, ' + 'each with a separate time zone setting.' + ), +) +setting_django_wsgi_application = namespace.add_setting( + global_name='WSGI_APPLICATION', + default=settings.WSGI_APPLICATION, + help_text=_( + 'The full Python path of the WSGI application object that Django\'s ' + 'built-in servers (e.g. runserver) will use. The django-admin ' + 'startproject management command will create a simple wsgi.py ' + 'file with an application callable in it, and point this setting ' + 'to that application.' + ), +) namespace = Namespace(name='celery', label=_('Celery'))