← Back to team overview

openerp-expert-framework team mailing list archive

Re: XML (de)serialization

 

Hi Raphael,

IMO, functional tests are top priority. OpenERP is big, complex, decentralized and is starting to age. Unlike Tryton, the somewhat large install base makes regressions a very costly issue. Couple that with being written in a dynamic language and every single change could introduce large unexpected errors. In IT, "Enterprise" means "no surprises".

Some old modules like "account" need refactoring badly, but without tests, those are shots in the dark. Tiny doesn't even have to write the tests, but just establish the standards. Be it OERPSenario, or Selenium or whatever, Tiny should pick one and coordinate the effort.

If I could propose something, the 5.2 feature freeze should last until a 5.4 release 3-to-6 months from now which would focus only on tests and refactorings. After that initial sprint, I'm confident the developers will absorb the "test culture".

Raphaël Valyi escreveu:
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 <mailto: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 <mailto: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
    <https://launchpad.net/%7Eopenerp-expert-framework>
    Post to     : openerp-expert-framework@xxxxxxxxxxxxxxxxxxx
    <mailto:openerp-expert-framework@xxxxxxxxxxxxxxxxxxx>
    Unsubscribe : https://launchpad.net/~openerp-expert-framework
    <https://launchpad.net/%7Eopenerp-expert-framework>
    More help   : https://help.launchpad.net/ListHelp






Follow ups

References