From c65e3656bda29fb08292b4e165719510a82dbb89 Mon Sep 17 00:00:00 2001 From: Ruben D Date: Thu, 29 Mar 2018 00:39:57 +0200 Subject: [PATCH] Fix persistence of setting names with uppercase characters The problem was that Python's ConfigParser doesn't preserve case. Everything becomes lowercase. Some post-processing scripts have uppercase characters in their setting keys and these weren't preserved. This fix configures the ConfigParser to pass the setting keys untransformed. The transformation function becomes the str() function which just passes the input through untransformed. --- plugins/PostProcessingPlugin/PostProcessingPlugin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/PostProcessingPlugin/PostProcessingPlugin.py b/plugins/PostProcessingPlugin/PostProcessingPlugin.py index 31bad0cfe8..d000c67dde 100644 --- a/plugins/PostProcessingPlugin/PostProcessingPlugin.py +++ b/plugins/PostProcessingPlugin/PostProcessingPlugin.py @@ -210,6 +210,7 @@ class PostProcessingPlugin(QObject, Extension): continue script_str = script_str.replace("\\n", "\n").replace("\\\\", "\\") #Unescape escape sequences. script_parser = configparser.ConfigParser(interpolation = None) + script_parser.optionxform = str #Don't transform the setting keys as they are case-sensitive. script_parser.read_string(script_str) for script_name, settings in script_parser.items(): #There should only be one, really! Otherwise we can't guarantee the order or allow multiple uses of the same script. if script_name == "DEFAULT": #ConfigParser always has a DEFAULT section, but we don't fill it. Ignore this one. @@ -230,6 +231,7 @@ class PostProcessingPlugin(QObject, Extension): script_list_strs = [] for script in self._script_list: parser = configparser.ConfigParser(interpolation = None) #We'll encode the script as a config with one section. The section header is the key and its values are the settings. + parser.optionxform = str #Don't transform the setting keys as they are case-sensitive. script_name = script.getSettingData()["key"] parser.add_section(script_name) for key in script.getSettingData()["settings"]: