mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
CURA-4924 always use interpolation = None for configparser, preventive
This commit is contained in:
parent
98f925d50c
commit
a460804bbe
2 changed files with 6 additions and 6 deletions
|
@ -122,7 +122,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
# The default ContainerStack.deserialize() will connect signals, which is not desired in this case.
|
# The default ContainerStack.deserialize() will connect signals, which is not desired in this case.
|
||||||
# Since we know that the stack files are INI files, so we directly use the ConfigParser to parse them.
|
# Since we know that the stack files are INI files, so we directly use the ConfigParser to parse them.
|
||||||
serialized = archive.open(file_name).read().decode("utf-8")
|
serialized = archive.open(file_name).read().decode("utf-8")
|
||||||
stack_config = ConfigParser()
|
stack_config = ConfigParser(interpolation = None)
|
||||||
stack_config.read_string(serialized)
|
stack_config.read_string(serialized)
|
||||||
|
|
||||||
# sanity check
|
# sanity check
|
||||||
|
@ -303,7 +303,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
if containers_found_dict["machine"] and not machine_conflict:
|
if containers_found_dict["machine"] and not machine_conflict:
|
||||||
for extruder_stack_file in extruder_stack_files:
|
for extruder_stack_file in extruder_stack_files:
|
||||||
serialized = archive.open(extruder_stack_file).read().decode("utf-8")
|
serialized = archive.open(extruder_stack_file).read().decode("utf-8")
|
||||||
parser = configparser.ConfigParser()
|
parser = configparser.ConfigParser(interpolation = None)
|
||||||
parser.read_string(serialized)
|
parser.read_string(serialized)
|
||||||
|
|
||||||
# The check should be done for the extruder stack that's associated with the existing global stack,
|
# The check should be done for the extruder stack that's associated with the existing global stack,
|
||||||
|
@ -407,7 +407,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
## Overrides an ExtruderStack in the given GlobalStack and returns the new ExtruderStack.
|
## Overrides an ExtruderStack in the given GlobalStack and returns the new ExtruderStack.
|
||||||
def _overrideExtruderStack(self, global_stack, extruder_file_content, extruder_stack_file):
|
def _overrideExtruderStack(self, global_stack, extruder_file_content, extruder_stack_file):
|
||||||
# Get extruder position first
|
# Get extruder position first
|
||||||
extruder_config = configparser.ConfigParser()
|
extruder_config = configparser.ConfigParser(interpolation = None)
|
||||||
extruder_config.read_string(extruder_file_content)
|
extruder_config.read_string(extruder_file_content)
|
||||||
if not extruder_config.has_option("metadata", "position"):
|
if not extruder_config.has_option("metadata", "position"):
|
||||||
msg = "Could not find 'metadata/position' in extruder stack file"
|
msg = "Could not find 'metadata/position' in extruder stack file"
|
||||||
|
@ -564,7 +564,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
serialized = archive.open(instance_container_file).read().decode("utf-8")
|
serialized = archive.open(instance_container_file).read().decode("utf-8")
|
||||||
|
|
||||||
# HACK! we ignore "quality" and "variant" instance containers!
|
# HACK! we ignore "quality" and "variant" instance containers!
|
||||||
parser = configparser.ConfigParser()
|
parser = configparser.ConfigParser(interpolation = None)
|
||||||
parser.read_string(serialized)
|
parser.read_string(serialized)
|
||||||
if not parser.has_option("metadata", "type"):
|
if not parser.has_option("metadata", "type"):
|
||||||
Logger.log("w", "Cannot find metadata/type in %s, ignoring it", instance_container_file)
|
Logger.log("w", "Cannot find metadata/type in %s, ignoring it", instance_container_file)
|
||||||
|
@ -762,7 +762,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
# deserialize() by setting the metadata, but in the case of ExtruderStack, deserialize()
|
# deserialize() by setting the metadata, but in the case of ExtruderStack, deserialize()
|
||||||
# also does addExtruder() to its machine stack, so we have to make sure that it's pointing
|
# also does addExtruder() to its machine stack, so we have to make sure that it's pointing
|
||||||
# to the right machine BEFORE deserialization.
|
# to the right machine BEFORE deserialization.
|
||||||
extruder_config = configparser.ConfigParser()
|
extruder_config = configparser.ConfigParser(interpolation = None)
|
||||||
extruder_config.read_string(extruder_file_content)
|
extruder_config.read_string(extruder_file_content)
|
||||||
extruder_config.set("metadata", "machine", global_stack_id_new)
|
extruder_config.set("metadata", "machine", global_stack_id_new)
|
||||||
tmp_string_io = io.StringIO()
|
tmp_string_io = io.StringIO()
|
||||||
|
|
|
@ -57,7 +57,7 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
|
||||||
|
|
||||||
# Save Cura version
|
# Save Cura version
|
||||||
version_file = zipfile.ZipInfo("Cura/version.ini")
|
version_file = zipfile.ZipInfo("Cura/version.ini")
|
||||||
version_config_parser = configparser.ConfigParser()
|
version_config_parser = configparser.ConfigParser(interpolation = None)
|
||||||
version_config_parser.add_section("versions")
|
version_config_parser.add_section("versions")
|
||||||
version_config_parser.set("versions", "cura_version", Application.getInstance().getVersion())
|
version_config_parser.set("versions", "cura_version", Application.getInstance().getVersion())
|
||||||
version_config_parser.set("versions", "build_type", Application.getInstance().getBuildType())
|
version_config_parser.set("versions", "build_type", Application.getInstance().getBuildType())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue