You can write your own __init__
method. In that case, the
meta __init__
is run to check all the values passed to the
constructor and to set all the attributes. Then, the user __init__
is run:
# -- # Copyright (C) CEA, EDF # Author : Erwan ADAM (CEA) # -- import unittest from xdata import * class A(XObject): __init__xattributes__ = [ XAttribute("x", xtype=XInt(min=0)), ] def __init__(self, *args, **kwargs): self.test = 1 return pass class ATestCase(unittest.TestCase): def test(self): a = A(1) self.failUnlessEqual(a.test, 1) return pass if __name__ == '__main__': unittest.main() pass