Add check for profile version

The profile reader now checks whether the profile version is the same as the target version in the Dictionary of Doom.

Contributes to issue CURA-37.
This commit is contained in:
Ghostkeeper 2015-12-18 10:50:54 +01:00
parent 68496349a9
commit 482f0461fc
2 changed files with 9 additions and 1 deletions

View file

@ -82,6 +82,14 @@ class LegacyProfileReader(ProfileReader):
Logger.log("e", "Could not parse DictionaryOfDoom.json: %s", str(e))
return None
#Check the target version in the Dictionary of Doom with this application version.
if "target_version" not in dict_of_doom:
Logger.log("e", "Dictionary of Doom has no target version. Is it the correct JSON file?")
return None
if Profile.ProfileVersion != dict_of_doom["target_version"]:
Logger.log("e", "Dictionary of Doom of legacy profile reader (version %s) is not in sync with the profile version (version %s)!", dict_of_doom["target_version"], str(Profile.ProfileVersion))
return None
if "translation" not in dict_of_doom:
Logger.log("e", "Dictionary of Doom has no translation. Is it the correct JSON file?")
return None