fix: handle DatabaseType enum conversion in config management
Fix type conversion issues when handling DatabaseType enum values in configuration loading and GUI updates. - config/loader.py: Handle both enum and string types for DB_TYPE - config/schema.py: Properly convert db_type when it's already a string - gui/config_manager.py: Add Enum type conversion with validation in set_nested_value These changes prevent AttributeError when accessing .value on string values and ensure proper type handling throughout the configuration system. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -111,7 +111,7 @@ class ConfigLoader:
|
||||
"ERP_IGNORE_HTTPS_ERRORS": config.erp.ignore_https_errors,
|
||||
"ERP_AUTO_CLOSE_BROWSER": config.erp.auto_close_browser,
|
||||
# 数据库配置
|
||||
"DB_TYPE": config.database.db_type.value,
|
||||
"DB_TYPE": config.database.db_type.value if isinstance(config.database.db_type, DatabaseType) else config.database.db_type,
|
||||
"DB_SERVER": config.database.server,
|
||||
"DB_NAME": config.database.database,
|
||||
"DB_USERNAME": config.database.username,
|
||||
|
||||
@@ -312,7 +312,7 @@ class AppConfig:
|
||||
"auto_close_browser": self.erp.auto_close_browser,
|
||||
},
|
||||
"database": {
|
||||
"db_type": self.database.db_type.value,
|
||||
"db_type": self.database.db_type if isinstance(self.database.db_type, str) else self.database.db_type.value,
|
||||
"server": self.database.server,
|
||||
"database": self.database.database,
|
||||
"username": self.database.username,
|
||||
|
||||
Reference in New Issue
Block a user