From c5bcb39af3293a8fc5de6502b390302a2d7d1011 2015-12-30 18:27:59 From: Miguel Valdez Date: 2015-12-30 18:27:59 Subject: [PATCH] Bug fixed in jrodata: Error working with more than one branch. When a value is updated in a branch this value is modified in every other branch because variables are references. --- diff --git a/schainpy/model/data/jrodata.py b/schainpy/model/data/jrodata.py index 9b464cd..857e944 100644 --- a/schainpy/model/data/jrodata.py +++ b/schainpy/model/data/jrodata.py @@ -118,6 +118,19 @@ class GenericData(object): return copy.deepcopy(self) for key in inputObj.__dict__.keys(): + + attribute = inputObj.__dict__[key] + + #If this attribute is a tuple or list + if type(inputObj.__dict__[key]) in (tuple, list): + self.__dict__[key] = attribute[:] + continue + + #If this attribute is another object or instance + if hasattr(attribute, '__dict__'): + self.__dict__[key] = attribute.copy() + continue + self.__dict__[key] = inputObj.__dict__[key] def deepcopy(self):