You have been assigned a bug task for a public bug by tfr (Openerp) (tfr):

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.

** Affects: openobject-addons
     Importance: Low
     Assignee: OpenERP R&D Addons Team 2 (openerp-dev-addons2)
         Status: Confirmed

** Affects: openobject-addons/extra-trunk
     Importance: Low
         Status: New

** Affects: openobject-addons/trunk
     Importance: Low
     Assignee: OpenERP R&D Addons Team 2 (openerp-dev-addons2)
         Status: Confirmed

** Affects: openobject-client
     Importance: Low
     Assignee: OpenERP sa GTK client R&D (openerp-dev-gtk)
         Status: Confirmed

** Affects: openobject-server
     Importance: Low
         Status: Confirmed

** Affects: openobject-server/trunk
     Importance: Low
         Status: Confirmed


** Tags: context refactoring
-- 
Default values should be immutable
https://bugs.launchpad.net/bugs/525808
You received this bug notification because you are a member of OpenERP sa GTK 
client R&D, which is a bug assignee.

_______________________________________________
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

Reply via email to