예제 #1
0
파일: context.py 프로젝트: iswangheng/cola
    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))
예제 #2
0
 def setUp(self):
     self.obj = PropertyObject({
         'name': 'cola',
         'list': [
             {
                 'count': 1
             },
             {
                 'count': 2
             },
         ]
     })