Added ability to use class methods as variable depend function. fixed #54
parent
9d26db03f0
commit
76a49228f0
@ -1,4 +1,24 @@
|
|||||||
from calculate.variables.datavars import Variable, StringType
|
from calculate.variables.datavars import Variable, StringType, Calculate
|
||||||
|
|
||||||
|
|
||||||
|
class A:
|
||||||
|
@classmethod
|
||||||
|
def test(cls):
|
||||||
|
return "test_0"
|
||||||
|
|
||||||
|
|
||||||
|
class B:
|
||||||
|
def __init__(self):
|
||||||
|
self._value = "test_1"
|
||||||
|
|
||||||
|
def test(self):
|
||||||
|
return self._value
|
||||||
|
|
||||||
|
|
||||||
|
b = B()
|
||||||
|
|
||||||
|
|
||||||
|
Variable("test_0", type=StringType, source=Calculate(A.test))
|
||||||
|
Variable("test_1", type=StringType, source=Calculate(b.test))
|
||||||
|
|
||||||
Variable('chroot', type=StringType.readonly, source='/')
|
Variable('chroot', type=StringType.readonly, source='/')
|
||||||
|
Loading…
Reference in new issue