mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
Cleanup casting from values in cfg
This commit is contained in:
parent
b63ec9bffc
commit
45fd4f2a53
@ -244,7 +244,7 @@ def configure_django():
|
||||
STATIC_URL='/'.join([cfg.server_dir, 'static/']).replace('//', '/'),
|
||||
STRONGHOLD_PUBLIC_NAMED_URLS=('users:login', 'users:logout'),
|
||||
TEMPLATE_CONTEXT_PROCESSORS=context_processors,
|
||||
USE_X_FORWARDED_HOST=bool(cfg.use_x_forwarded_host))
|
||||
USE_X_FORWARDED_HOST=cfg.use_x_forwarded_host)
|
||||
django.setup()
|
||||
|
||||
logger.info('Configured Django with applications - %s', applications)
|
||||
|
||||
@ -96,6 +96,8 @@ def read():
|
||||
else:
|
||||
if datatype == 'int':
|
||||
value = int(value)
|
||||
|
||||
if datatype == 'bool':
|
||||
value = value.lower() == 'true'
|
||||
value = (value.lower() == 'true')
|
||||
|
||||
globals()[name] = value
|
||||
|
||||
@ -222,6 +222,7 @@ class CfgTestCase(unittest.TestCase):
|
||||
self.assertEqual(int(parser.get('Network', 'port')), cfg.port)
|
||||
self.assertEqual(parser.get('Network', 'secure_proxy_ssl_header'),
|
||||
cfg.secure_proxy_ssl_header)
|
||||
self.assertIsInstance(cfg.use_x_forwarded_host, bool)
|
||||
self.assertEqual(parser.get('Network', 'use_x_forwarded_host'),
|
||||
str(cfg.use_x_forwarded_host))
|
||||
self.assertEqual(parser.get('Misc', 'danube_edition'),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user