Code review comment for lp:~camptocamp/openerp-connector/7.0-connector-closure-functions

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

> Hello,
>
> Good idea, but if you apply a Higher-order function to your mapping is still a
> "direct"
> mapping ? I find it a little bit confusing, but I get the finality of the
> change.

Maybe the name 'direct' was unfortunate in a first place. But that's still 'direct' in a sense: from 1 attribute to 1 attribute, we just place a modifier between them.

>
> Maybe we may add a new "middleware or what else" class attribute that will
> allows to wrap any of the transformation (direct or not) with a wrapping
> function. Like in ring/wsgi etc webstack handler.

My first opinion is that I think that will make the mappings more complex, the solution proposed here is straightforward and readable, example:

    direct = [(backend_to_m2o('deal_id'), 'offer_id'),
              (backend_to_m2o('product_id', binding='qoqa.product.template'), 'product_tmpl_id'),
              (backend_to_m2o('vat_id'), 'tax_id'),
              ('lot_size', 'lot_size'),
              ('unit_price', 'unit_price'),
              ]

Though, I don't think I get what you mean. Can you write an example of how you would use it on a Mapper?

>
> Regards
>
> Nicolas

« Back to merge proposal