The default format version and file version should be 1

This commit is contained in:
Andrew Resch 2009-07-05 17:42:36 +00:00
parent e9f62ea08c
commit 1b997b2349
1 changed files with 6 additions and 4 deletions

View File

@ -105,8 +105,8 @@ class Config(object):
self.__change_callbacks = [] self.__change_callbacks = []
# These hold the version numbers and they will be set when loaded # These hold the version numbers and they will be set when loaded
self.__format_version = None self.__format_version = 1
self.__file_version = None self.__file_version = 1
# This will get set with a reactor.callLater whenever a config option # This will get set with a reactor.callLater whenever a config option
# is set. # is set.
@ -331,6 +331,7 @@ class Config(object):
try: try:
self.__config.update(json.loads(fdata)) self.__config.update(json.loads(fdata))
except Exception, e: except Exception, e:
log.exception(e)
try: try:
self.__config.update(pickle.loads(fdata)) self.__config.update(pickle.loads(fdata))
except Exception, e: except Exception, e:
@ -357,8 +358,9 @@ class Config(object):
# We will only write a new config file if there is a difference # We will only write a new config file if there is a difference
try: try:
data = open(filename, "rb") data = open(filename, "rb")
data.seek(4) data.readline()
loaded_data = json.load(data) data.readline()
loaded_data = json.loads(data.read())
data.close() data.close()
if self.__config == loaded_data: if self.__config == loaded_data:
# The config has not changed so lets just return # The config has not changed so lets just return