Add the missing preference upgrade for 4.9 to 4.10

This could break backups in certain cases

CURA-8521
This commit is contained in:
Jaime van Kessel 2021-08-30 10:51:27 +02:00
parent 8de5e1e5b9
commit 9bdeb82314
2 changed files with 20 additions and 0 deletions

View file

@ -104,6 +104,25 @@ class VersionUpgrade49to410(VersionUpgrade):
"g" : "D060"
}
def upgradePreferences(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
"""
Upgrades preferences to have the new version number.
:param serialized: The original contents of the preferences file.
:param filename: The file name of the preferences file.
:return: A list of new file names, and a list of the new contents for
those files.
"""
parser = configparser.ConfigParser(interpolation = None)
parser.read_string(serialized)
# Update version number.
parser["metadata"]["setting_version"] = "17"
result = io.StringIO()
parser.write(result)
return [filename], [result.getvalue()]
def upgradeInstanceContainer(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
"""Upgrades instance containers to have the new version number.

View file

@ -21,6 +21,7 @@ def getMetaData() -> Dict[str, Any]:
("quality_changes", 4000016): ("quality_changes", 4000017, upgrade.upgradeInstanceContainer),
("quality", 4000016): ("quality", 4000017, upgrade.upgradeInstanceContainer),
("user", 4000016): ("user", 4000017, upgrade.upgradeInstanceContainer),
("preferences", 7000016): ("preferences", 7000017, upgrade.upgradePreferences),
},
"sources": {
"machine_stack": {