small refactoring of literal_eval
add compatibility with OpenERP 7

courtesy of Nicolas Bessi
fix tests for OpenERP 7