def __init__(self, user_conf=None, **user_defines): self.main_conf = main_conf if user_conf is not None: if isinstance(user_conf, str): self.user_conf = Config(user_conf) else: self.user_conf = user_conf else: self.user_conf = PropertyObject(dict()) self.user_defines = PropertyObject(user_defines) dicts = PropertyObject({}) for obj in (self.main_conf, self.user_conf, self.user_defines): dicts.update(obj) for k in dicts: if not k.startswith('_'): setattr(self, k, getattr(dicts, k))
def setUp(self): self.obj = PropertyObject({ 'name': 'cola', 'list': [ { 'count': 1 }, { 'count': 2 }, ] })