Hello
Is there way to test some PYSON statement with proteus or tryton-console
?
An example somewhere?
regards.
Hello
Is there way to test some PYSON statement with proteus or tryton-console
?
An example somewhere?
regards.
What do you want to test?
Domain statement for example : If my writing are correct and understand why if it not correct
If it compiles, it is valid.
It might be valid but not correct for the purpose intended
Here’s a quick session I did that checks an expression against a record
>>> from trytond.pyson import Eval, PYSONEncoder, PYSONDecoder
>>> from trytond.model.modelstorage import EvalEnvironment
>>> Party = pool.get('party.party')
>>> a = Party(1)
>>> env = EvalEnvironment(a, Party)
>>> b = Eval('name') == 'test'
>>> PYSONDecoder(env).decode(PYSONEncoder().encode(b))
False
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.