1. class DtoBase(object):
    2. def __init__(self,dict=None):
    3. self.__toDTO__(dict)
    4. def __toDTO__(self,dict):
    5. if dict == None:
    6. return
    7. for k,v in self.__dict__.items():
    8. if dict.get(k,None) != None:
    9. setattr(self,k,dict.get(k))