openerp-expert-framework team mailing list archive
-
openerp-expert-framework team
-
Mailing list archive
-
Message #00399
Re: Accepting (int, long) apart from list
On Monday 09 August 2010, Albert Cervera i Areny wrote:
> Lately, there seem to have gone several commits into 5.0 branch in both
> server and addons repositories which ensure some write() and unlink()
> functions accept integers and longs instead of a list of integers or longs
> in the 'ids' parameter.
>
> It seems to me we're moving to the wrong direction. ..
> def write(self, cr, uid, ids, vals, context={}):
> + if isinstance(ids, (int, long)):
> + ids = [ids]
I've been among the ones that do such changes. I believe that handling that
one id, instead of breaking the transaction, was more stable.
So, a write(cr,uid, 634, vals..) would behave like write(cr, uid, [634,],
vals...) . Is there a case where we wouldn't want this behavior, where a
strict definition of arguments would be better?
Remember that it's not that easy to correct all modules to call
write(..,list[],..) everywhere. We are in a weak-typed language and types may
be anything.
Follow ups
References