mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 21:29:11 +00:00
Deep copy the default_config constant to prevent it being overwritten
- Issue
- In the previous form, updates to self.current_config would update
default_config as python does a shallow copy
- So self.current_config is just referencing the values of default_config
- Hence updates to current_config updates the default_config values too
- This is not what we want
- Fix
- Deep copy the default_config values. Now updates to
self.current_config wouldn't affect the default_config
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
# Standard Packages
|
# Standard Packages
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from copy import deepcopy
|
||||||
|
|
||||||
|
|
||||||
# External Packages
|
# External Packages
|
||||||
from PyQt6 import QtWidgets
|
from PyQt6 import QtWidgets
|
||||||
@@ -31,7 +33,7 @@ class ConfigureScreen(QtWidgets.QDialog):
|
|||||||
if resolve_absolute_path(self.config_file).exists():
|
if resolve_absolute_path(self.config_file).exists():
|
||||||
self.current_config = yaml_utils.load_config_from_file(self.config_file)
|
self.current_config = yaml_utils.load_config_from_file(self.config_file)
|
||||||
else:
|
else:
|
||||||
self.current_config = constants.default_config
|
self.current_config = deepcopy(constants.default_config)
|
||||||
self.new_config = self.current_config
|
self.new_config = self.current_config
|
||||||
|
|
||||||
# Initialize Configure Window
|
# Initialize Configure Window
|
||||||
|
|||||||
Reference in New Issue
Block a user