On 03/07/2012 11:22 AM, Antony Lesuisse (OpenERP) wrote: > We wont change this now (i mean replacing context by context.copy()), as > we are designing a new high level api that will remove the cr, uid, ids > context from function arguments.
If you are wondering, this is in fact an early draft idea, and there is of course no definitive choice for the new API. We will try to build (one or more) proof of concept of it, including a way to make the system backwards compatible with the old API, and then ask the Framework Experts to review :-) PS: for such discussion we should stick to the list, not use bug comments -- You received this bug notification because you are a member of OpenERP sa GTK client R&D, which is a bug assignee. https://bugs.launchpad.net/bugs/525808 Title: Default values should be immutable Status in OpenERP Addons (modules): Opinion Status in OpenERP Addons extra-trunk series: Opinion Status in OpenERP Addons trunk series: Opinion Status in OpenERP GTK Client: Opinion Status in OpenERP Server: Fix Released Status in OpenERP Server trunk series: Fix Released Bug description: Often in the code base we have: def foo(...., context={},....): .... As explained in comment #1, this should be changed to def foo(...., context=None,....): # you should add this test only if the context is actually used if context is None: context={} .... (This bug originally proposed the other way round hence the "nope" in comment #1.) (xmo) Complements of information: * The test should be `context is None` rather than `not context`: the caller could provide an empty dict argument {} and expect to have data in it after the call, if a test is done using `not context` an empty dict will match and the function will be creating a brand new context. * The test should *only ever* performed when the current function fetches data from the context. If you don't do anything with the context but forward it to other functions and methods (e.g. read() or create()), no need to test for anything. To manage notifications about this bug go to: https://bugs.launchpad.net/openobject-addons/+bug/525808/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-gtk Post to : [email protected] Unsubscribe : https://launchpad.net/~openerp-dev-gtk More help : https://help.launchpad.net/ListHelp

