Exemplo n.º 1
0
def load_model_from_ini(filename, model):
    model.__model_ini_filename__ = filename
    tempopts = get_tempopts(filename)
    for attr in model.__model_attrs_map__.values():
        if tempopts.has_option(attr.group, attr.name):
            data = tempopts.get(attr.group, attr.name)
            val = attr.rtype.unserialize(data)
            if val == '':
                val = attr.default
            property_evading_setattr(model, attr.key, val)
    return model
Exemplo n.º 2
0
def load_model_from_ini(filename, model):
    model.__model_ini_filename__ = filename
    tempopts = get_tempopts(filename)
    for attr in model.__model_attrs_map__.values():
        if tempopts.has_option(attr.group, attr.name):
            data = tempopts.get(attr.group, attr.name)
            val = attr.rtype.unserialize(data)
            if val == '':
                val = attr.default
            property_evading_setattr(model, attr.key, val)
    return model
Exemplo n.º 3
0
 def test_b_prop(self):
     property_evading_setattr(self.b, 'g', 10)
     self.assertEqual(self.b.g, 10)
Exemplo n.º 4
0
 def test_a_plain(self):
     property_evading_setattr(self.b, 'f', 10)
     self.assertEqual(self.b.f, 10)
Exemplo n.º 5
0
 def test_b_prop(self):
     property_evading_setattr(self.b, 'g', 10)
     self.assertEqual(self.b.g, 10)
Exemplo n.º 6
0
 def test_a_plain(self):
     property_evading_setattr(self.b, 'f', 10)
     self.assertEqual(self.b.f, 10)