Bug in comparing defaults if no deepcopy

svn: r14087
This commit is contained in:
Doug Blank 2010-01-17 20:23:56 +00:00
parent b66e96b8d9
commit e2bbd220bb

View File

@ -36,6 +36,7 @@ import sys
import time import time
import ConfigParser import ConfigParser
import errno import errno
import copy
try: try:
from ast import literal_eval as safe_eval from ast import literal_eval as safe_eval
@ -196,13 +197,13 @@ class ConfigManager(object):
for section in self.default: for section in self.default:
self.data[section] = {} self.data[section] = {}
for setting in self.default[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: elif setting is None:
self.data[section] = {} self.data[section] = {}
for setting in self.default[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: else:
self.data[section][setting] = self.default[section][setting] self.data[section][setting] = copy.deepcopy(self.default[section][setting])
# Callbacks are still connected # Callbacks are still connected
def get_sections(self): def get_sections(self):
@ -397,7 +398,7 @@ class ConfigManager(object):
if setting not in self.data[section]: if setting not in self.data[section]:
self.data[section][setting] = default self.data[section][setting] = default
# Set the default, regardless: # Set the default, regardless:
self.default[section][setting] = default self.default[section][setting] = copy.deepcopy(default)
def connect(self, key, func): def connect(self, key, func):
""" """