dav_base: cosmetics
Run tests / Execute tox to run the test suite (push) Successful in 3m29s

This commit is contained in:
2026-05-28 14:51:49 +02:00
parent efd2305b35
commit d9cfffb8c2
8 changed files with 63 additions and 41 deletions
+14 -11
View File
@@ -5,7 +5,8 @@ import sys
from importlib.resources import files as resource_files
from django.core.management import execute_from_command_line
from dav_base.config.modules import DJANGO_MAIN_MODULE, ModuleConfig
from dav_base.constants import DJANGO_MAIN_MODULE, MODULE_APP_SETTINGS_PREFIX
from dav_base.config.modules import ModuleConfig
VERSION = '0.1'
@@ -94,46 +95,48 @@ class AdminCommand: # pylint: disable=too-few-public-methods
config = ModuleConfig(django_base_dir=django_base_dir)
config.save()
input_file = resource_files(__package__).joinpath('django_project_config', 'additional_settings.py')
input_file = resource_files(__package__).joinpath('django_project_config',
'additional_settings.py')
output_file = os.path.join(django_base_dir, django_main_module, 'settings.py')
with open(output_file, 'ab') as f:
f.write(input_file.read_bytes())
input_file = resource_files(__package__).joinpath('django_project_config', 'urls.py')
input_file = resource_files(__package__).joinpath('django_project_config',
'urls.py')
output_file = os.path.join(django_base_dir, django_main_module, 'urls.py')
with open(output_file, 'wb') as f:
f.write(input_file.read_bytes())
input_file = resource_files(__package__).joinpath('django_project_config', 'settings-dav_base.py')
output_file = os.path.join(django_base_dir, django_main_module, 'settings-dav_base.py')
input_file = resource_files(__package__).joinpath('django_project_config',
'{prefix}dav_base.py'.format(prefix=MODULE_APP_SETTINGS_PREFIX))
output_file = os.path.join(django_base_dir,
django_main_module,
'{prefix}dav_base.py'.format(prefix=MODULE_APP_SETTINGS_PREFIX))
with open(output_file, 'wb') as f:
f.write(input_file.read_bytes())
return posix.EX_OK
def _subcmd_enable_module(self, cmd_args):
django_main_module = DJANGO_MAIN_MODULE
django_base_dir = cmd_args.path
module_name = cmd_args.module
sys.path.append(django_base_dir)
os.environ['DJANGO_SETTINGS_MODULE'] = '{}.settings'.format(django_main_module)
os.environ['DJANGO_SETTINGS_MODULE'] = '{}.settings'.format(DJANGO_MAIN_MODULE)
execute_from_command_line(['manage.py', 'enable_module', module_name])
return posix.EX_OK
def _subcmd_disable_module(self, cmd_args):
django_main_module = DJANGO_MAIN_MODULE
django_base_dir = cmd_args.path
module_name = cmd_args.module
sys.path.append(django_base_dir)
os.environ['DJANGO_SETTINGS_MODULE'] = '{}.settings'.format(django_main_module)
os.environ['DJANGO_SETTINGS_MODULE'] = '{}.settings'.format(DJANGO_MAIN_MODULE)
execute_from_command_line(['manage.py', 'disable_module', module_name])
return posix.EX_OK
def _subcmd_list_modules(self, cmd_args):
django_main_module = DJANGO_MAIN_MODULE
django_base_dir = cmd_args.path
sys.path.append(django_base_dir)
os.environ['DJANGO_SETTINGS_MODULE'] = '{}.settings'.format(django_main_module)
os.environ['DJANGO_SETTINGS_MODULE'] = '{}.settings'.format(DJANGO_MAIN_MODULE)
execute_from_command_line(['manage.py', 'list_modules'])
return posix.EX_OK