P. Christeas escribió:
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.
_______________________________________________
Mailing list: https://launchpad.net/~openerp-expert-framework
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-expert-framework
More help : https://help.launchpad.net/ListHelp
I like being able to use a single id as a parameter for
write/read/browse..., it is more user (console) friendly, specially with
the browse.
But it is true that it may cause mistakes, for example I have seen some
modules expecting the return for this methods to be a single element
(like the analytic account bug of two months ago, where only the first
account move to be confirmed got its analytic entries created).
--
Borja López Soilán
[email protected]
Pexego Sistemas Informáticos S.L.
Avenida de Magoi 66 - 27002 Lugo (España)
Tel./Fax 982801517
http://www.pexego.es
AVISO LEGAL - CLÁUSULA DE PRIVACIDAD
Este mensaje se dirige exclusivamente a su destinatario y puede contener información privilegiada o confidencial. Si no es usted el destinatario indicado, queda informado de que la utilización, divulgación y/o copia sin autorización está prohibida en virtud de la legislación vigente. Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente por esta misma vía y proceda a su destrucción.
_______________________________________________
Mailing list: https://launchpad.net/~openerp-expert-framework
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-expert-framework
More help : https://help.launchpad.net/ListHelp