Correctly me if i'm wrong but this widged will be simply a Char (or Text) widget which converts (and validates) some input text to a valid PYSON expression (which will be decoded by the server)
Indeed we never raise exception from the widget. So I think we should just set the value to None if it is not a valid statement.
But maybe it will be good to add a small icon in the Entry which could be green or red (OK - CANCEL). It will be updated on insert-text by evaluating the text.
I updated all the reviews. tryton and trytond can be tested, for sao we are still missing the toString method of all objects as currently the PYSON widget is rendered as [Object Object]