Add get_win32_portable_user_data_path() function in main.py to return
correct user data path ("/openslides") of portable version.
This commit is contained in:
parent
943ede2e81
commit
3ece699cd6
@ -136,8 +136,8 @@ def get_default_settings_context(user_data_path=None):
|
||||
else:
|
||||
openslides_type = detect_openslides_type()
|
||||
if openslides_type == WINDOWS_PORTABLE_VERSION:
|
||||
default_context['openslides_user_data_path'] = 'get_win32_portable_path()'
|
||||
default_context['import_function'] = 'from openslides.utils.main import get_win32_portable_path'
|
||||
default_context['openslides_user_data_path'] = 'get_win32_portable_user_data_path()'
|
||||
default_context['import_function'] = 'from openslides.utils.main import get_win32_portable_user_data_path'
|
||||
else:
|
||||
path = get_default_user_data_path(openslides_type)
|
||||
default_context['openslides_user_data_path'] = repr(os.path.join(path, 'openslides'))
|
||||
@ -208,6 +208,13 @@ def get_win32_portable_path():
|
||||
return portable_path
|
||||
|
||||
|
||||
def get_win32_portable_user_data_path():
|
||||
"""
|
||||
Returns the user data path to the Windows portable version.
|
||||
"""
|
||||
return os.path.join(get_win32_portable_path(), 'openslides')
|
||||
|
||||
|
||||
def write_settings(settings_path, template=None, **context):
|
||||
"""
|
||||
Creates the settings file at the given path using the given values for the
|
||||
|
@ -41,7 +41,7 @@ class TestFunctions(TestCase):
|
||||
def test_get_default_settings_context_portable(self, detect_mock):
|
||||
detect_mock.return_value = WINDOWS_PORTABLE_VERSION
|
||||
context = get_default_settings_context()
|
||||
self.assertEqual(context['openslides_user_data_path'], 'get_win32_portable_path()')
|
||||
self.assertEqual(context['openslides_user_data_path'], 'get_win32_portable_user_data_path()')
|
||||
|
||||
def test_setup_django_settings_module(self):
|
||||
setup_django_settings_module('test_dir_dhvnghfjdh456fzheg2f/test_path_bngjdhc756dzwncshdfnx.py')
|
||||
|
Loading…
Reference in New Issue
Block a user