Fix serialization of DictClass

using it in Queue.put somehow broke it
This commit is contained in:
Anders Ingemann 2015-01-25 19:52:28 +01:00
parent 51e9e29b24
commit 3c642e0b02
2 changed files with 21 additions and 14 deletions

View file

@ -78,20 +78,6 @@ class BootstrapInformation(object):
:return: The manifest_vars dictionary
:rtype: dict
"""
class DictClass(dict):
"""Tiny extension of dict to allow setting and getting keys via attributes
"""
def __getattr__(self, name):
return self[name]
def __setattr__(self, name, value):
self[name] = value
def __delattr__(self, name):
del self[name]
def __getstate__(self):
return self.__dict__
def set_manifest_vars(obj, data):
"""Runs through the manifest and creates DictClasses for every key
@ -139,3 +125,23 @@ class BootstrapInformation(object):
def __setstate__(self, state):
for key in state:
self.__dict__[key] = state[key]
class DictClass(dict):
"""Tiny extension of dict to allow setting and getting keys via attributes
"""
def __getattr__(self, name):
return self[name]
def __setattr__(self, name, value):
self[name] = value
def __delattr__(self, name):
del self[name]
def __getstate__(self):
return self.__dict__
def __setstate__(self, state):
for key in state:
self[key] = state[key]

View file

@ -6,6 +6,7 @@ log = logging.getLogger(__name__)
supported_classes = ['bootstrapvz.base.manifest.Manifest',
'bootstrapvz.base.bootstrapinfo.BootstrapInformation',
'bootstrapvz.base.bootstrapinfo.DictClass',
'bootstrapvz.common.fs.loopbackvolume.LoopbackVolume',
'bootstrapvz.common.fs.qemuvolume.QEMUVolume',
'bootstrapvz.common.fs.virtualdiskimage.VirtualDiskImage',