Fix problem when (de-)serializing bootstrapinfo twice

This commit is contained in:
Anders Ingemann 2015-01-25 20:00:57 +01:00
parent 3c642e0b02
commit e035f83edf

View file

@ -118,7 +118,10 @@ class BootstrapInformation(object):
state = self.__dict__.copy()
exclude_keys = ['source_lists', 'preference_lists', 'packages']
for key in exclude_keys:
del state[key]
# We may have been serialized before,
# so don't fail if the keys do not exist
if key in state:
del state[key]
state['__class__'] = self.__module__ + '.' + self.__class__.__name__
return state