From e2bbd220bb9e52aa99911e8d7f37265f5cfd675e Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sun, 17 Jan 2010 20:23:56 +0000 Subject: [PATCH] Bug in comparing defaults if no deepcopy svn: r14087 --- src/gen/utils/configmanager.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gen/utils/configmanager.py b/src/gen/utils/configmanager.py index 32829fe01..65961d21a 100644 --- a/src/gen/utils/configmanager.py +++ b/src/gen/utils/configmanager.py @@ -36,6 +36,7 @@ import sys import time import ConfigParser import errno +import copy try: from ast import literal_eval as safe_eval @@ -196,13 +197,13 @@ class ConfigManager(object): for section in self.default: self.data[section] = {} for setting in self.default[section]: - self.data[section][setting] = self.default[section][setting] + self.data[section][setting] = copy.deepcopy(self.default[section][setting]) elif setting is None: self.data[section] = {} for setting in self.default[section]: - self.data[section][setting] = self.default[section][setting] + self.data[section][setting] = copy.deepcopy(self.default[section][setting]) else: - self.data[section][setting] = self.default[section][setting] + self.data[section][setting] = copy.deepcopy(self.default[section][setting]) # Callbacks are still connected def get_sections(self): @@ -397,7 +398,7 @@ class ConfigManager(object): if setting not in self.data[section]: self.data[section][setting] = default # Set the default, regardless: - self.default[section][setting] = default + self.default[section][setting] = copy.deepcopy(default) def connect(self, key, func): """