class DtoBase(object): def __init__(self,dict=None): self.__toDTO__(dict) def __toDTO__(self,dict): if dict == None: return for k,v in self.__dict__.items(): if dict.get(k,None) != None: setattr(self,k,dict.get(k))