[core] Make apps can fail because of config dependency
@@ -36,7 +36,6 @@ from django.utils.translation import ugettext_lazy as _
import desktop.redaction
-from desktop.conf import has_channels
from desktop.lib.paths import get_desktop_root, get_run_root
from desktop.lib.python_util import force_dict_to_strings
@@ -448,7 +447,9 @@ if desktop.conf.SESSION.TRUSTED_ORIGINS.get():
if desktop.conf.KNOX.KNOX_PROXYHOSTS.get(): # The hosts provided here don't have port. Add default knox port
if desktop.conf.KNOX.KNOX_PORTS.get():
hostport = []
- ports = [host.split(':')[1] for host in desktop.conf.KNOX.KNOX_PROXYHOSTS.get() if len(host.split(':')) > 1] # In case the ports are in hostname
+ ports = [ # In case the ports are in hostname
+ host.split(':')[1] for host in desktop.conf.KNOX.KNOX_PROXYHOSTS.get() if len(host.split(':')) > 1
+ ]
for port in ports + desktop.conf.KNOX.KNOX_PORTS.get():
if port == '80':
port = '' # Default port needs to be empty
@@ -502,7 +503,7 @@ if EMAIL_BACKEND == 'sendgrid_backend.SendgridBackend':
SENDGRID_SANDBOX_MODE_IN_DEBUG = DEBUG
-if has_channels():
+if desktop.conf.has_channels():
INSTALLED_APPS.append('channels')
ASGI_APPLICATION = 'desktop.routing.application'
CHANNEL_LAYERS = {
@@ -514,7 +515,8 @@ if has_channels():
},
}
-# Used for securely creating sessions. Should be unique and not shared with anybody. Changing auth backends will invalidate all open sessions.
+# Used for securely creating sessions. Should be unique and not shared with anybody.
+# Changing auth backends will invalidate all open sessions.
SECRET_KEY = desktop.conf.get_secret_key()
if SECRET_KEY:
SECRET_KEY += str(AUTHENTICATION_BACKENDS)
@@ -645,7 +647,8 @@ if desktop.conf.SSL_CACERTS.get() and os.environ.get('REQUESTS_CA_BUNDLE') is No
os.environ['REQUESTS_CA_BUNDLE'] = desktop.conf.SSL_CACERTS.get()
# Preventing local build failure by not validating the default value of REQUESTS_CA_BUNDLE
-if os.environ.get('REQUESTS_CA_BUNDLE') and os.environ.get('REQUESTS_CA_BUNDLE') != desktop.conf.SSL_CACERTS.config.default and not os.path.isfile(os.environ['REQUESTS_CA_BUNDLE']):
+if os.environ.get('REQUESTS_CA_BUNDLE') and os.environ.get('REQUESTS_CA_BUNDLE') != desktop.conf.SSL_CACERTS.config.default \
+ and not os.path.isfile(os.environ['REQUESTS_CA_BUNDLE']):
raise Exception(_('SSL Certificate pointed by REQUESTS_CA_BUNDLE does not exist: %s') % os.environ['REQUESTS_CA_BUNDLE'])
# Instrumentation
