← Back to team overview

openerp-expert-framework team mailing list archive

Re: XML (de)serialization

 

Hello Cloves,

not analysed that your proposal yet, but I let you know (they told us at the
IRC community meeting) that Tiny has finally understood the benefit of
loading data with YAML, and idea both of us have been actively defending.
They are interested in making it possible in 5.2 (I still insist that there
are more urgent refactoring to be done first rather than let module build on
sand). Their primary interest is to make it less cumbersome to write
~unit/~functional tests embedded with modules (evolving their current test
framework). IMHO this is very welcome but wouldn't question OERPSenario
which is the only tool able to test complex cross modules features in a
business readable way (Cucumber based). Still, aside from their pseudo unit
test, it would be very welcome to be able to use YAML to load data/do the
ERP customization instead of the XML unreadable bloat, at least those coming
months were the RAD tools are not yet usable for serious integrator usage,
past the slideware. If you have resources, you can try to team with Xavier
Morel or Julien Thewys from Tiny/OpenERP which seems tracking that feature.

Happy to see YAML and tests gaining mindshare at Tiny.Will analyse that new
proposal later hopefully, thank you for contributing.

Raphaël Valyi
http://www.akretion.com


On Wed, Feb 17, 2010 at 7:47 PM, Cloves Almeida <cjalmeida@xxxxxxxxx> wrote:

> About the improvements in XML, I'd like to propose a obj-to-vals (the
> list/dict format suitable for write/create osv methods) and vals-to-xml
> methods to osv.osv objects. The code developed by me with Dukai's help is
> below.
>
> http://paste-it.net/public/s29b2ca/
>
> The methods are somewhat documented. Basically it converts the an osv.osv
> object into a simple and human-friendly xml format.
> For example, a res_partner object should give the expected output:
> <customer>
> <id>100</id>
> <name>Cliente Teste</name>
> <active>True</active>
> <credit_limit>1000.00</credit_limit>
> <address>
> <item>
> <id>150</id>
> <name>José da Silva</name>
> <type>default</type>
> <stree1>Av. Goiás, 100, Ap 10</stree1>
> <street2>Setor Central</street2>
> <city>Goiânia</city>
> <state_code>GO</state_code>
> <country_code>BR</country_code>
> <zip>74351018</zip>
> <email>joao_silva@xxxxxxxxx</email>
> <phone>62-5555-0000</phone>
> <fax>62-5555-0001</fax>
> <mobile>62-5555-0002</mobile>
> </item>
> </address>
> </customer>
>
>
> All you need is a very simple binding declaring what you want in your xml.
> For the example above, you should provide:
>
>        binding = [
>                'id',
>                'name',
>                'active',
>                'credit_limit',
>                ('address','address', [
>                        'id',
>                        'name',
>                        'type',
>                        'street',
>                        'street2',
>                        'city',
>                        ('state_id', 'state_code', 'code'),
>                        ('country_id', 'country_code', 'code'),
>                        'zip',
>                        'email',
>                        'phone',
>                        'fax',
>                        'mobile'
>                    ]
>                )
>        ]
>
> By default, the serialization return a lxml object that can be further
> customized in code. The deserialization method accepts either a xml string
> or a lxml object so you can customize it prior to parsing.
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-expert-framework
> Post to     : openerp-expert-framework@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openerp-expert-framework
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References