mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-13 01:37:51 -06:00
Return None if config file wasn't correct
This was actually specified in the original function description. Contributes to issue CURA-844.
This commit is contained in:
parent
0d553c10f1
commit
724f9ce010
2 changed files with 8 additions and 2 deletions
|
@ -13,7 +13,10 @@ import io #To write config files to strings as if they were files.
|
||||||
# \return A machine instance instance, or None if the file format is
|
# \return A machine instance instance, or None if the file format is
|
||||||
# incorrect.
|
# incorrect.
|
||||||
def importVersion1(serialised):
|
def importVersion1(serialised):
|
||||||
|
try:
|
||||||
return MachineInstance(serialised)
|
return MachineInstance(serialised)
|
||||||
|
except configparser.Error, SettingsError.InvalidFormatError, SettingsError.InvalidVersionError:
|
||||||
|
return None
|
||||||
|
|
||||||
## A representation of a machine instance used as intermediary form for
|
## A representation of a machine instance used as intermediary form for
|
||||||
# conversion from one format to the other.
|
# conversion from one format to the other.
|
||||||
|
|
|
@ -12,7 +12,10 @@ import io #To write config files to strings as if they were files.
|
||||||
# \param serialised The serialised form of a profile in version 1.
|
# \param serialised The serialised form of a profile in version 1.
|
||||||
# \return A profile instance, or None if the file format is incorrect.
|
# \return A profile instance, or None if the file format is incorrect.
|
||||||
def importVersion1(serialised):
|
def importVersion1(serialised):
|
||||||
|
try:
|
||||||
return Profile(serialised)
|
return Profile(serialised)
|
||||||
|
except configparser.Error, SettingsError.InvalidFormatError, SettingsError.InvalidVersionError:
|
||||||
|
return None
|
||||||
|
|
||||||
## A representation of a profile used as intermediary form for conversion from
|
## A representation of a profile used as intermediary form for conversion from
|
||||||
# one format to the other.
|
# one format to the other.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue