To be more indepedent about the python on the client side, we should improve
the syntax of the evaluated strings.

First, we need a syntax to represent data that is indepedent of Python and
that can handle list, dictionnary, string, number etc.
We thought about json which seems to be implemented in many languages and is
extendable.
Here is some examples:

A domain from ir.action.act_window:

[('parent', '=', False)] => [{'__class__': 'eval', 'v': "['parent', '=', 
False]"}]


A context from ir.action.act_window:

{'company': company} =>     {'company': {'__class__': 'eval', 'v': "company or 
False"}}


A digits from a Float:

(16, currency_digits) =>    {'__class__': 'eval', 'v': "[16, currency_digits]"}


A states like currency in account.invoice:

bool(lines) =>              {'__class__': 'eval', 'v': "len(lines) and True or 
False"}


As you can see, we define a new class of object "eval" which represents the 
strings
that must be evaluated on the client side.


Second, we need an easy and simple syntax that can be implemented in other
languages. So we will restrict it to the use of:

Type:
    str, int/long, list

Operators:
    and, or

Functions:
    contains, getitem, len

Functions could be added later depending of the needs.

-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email: [email protected]
Jabber: [email protected]
Website: http://www.b2ck.com/
twitter: http://twitter.com/cedrickrier
identi.ca: http://identi.ca/cedrickrier

Attachment: pgpvOYIHqlhHJ.pgp
Description: PGP signature

Reply via email to