2010-02-22 15:25:30 |
Numérigraphe |
bug |
|
|
added bug |
2010-02-22 15:51:15 |
Xavier (Open ERP) |
openobject-addons: status |
New |
Invalid |
|
2010-02-22 16:10:55 |
Numérigraphe |
summary |
default Context=False in methods/functions |
Default Context should be None in methods/functions |
|
2010-02-22 16:14:58 |
Numérigraphe |
description |
Often in the code base we have :
def foo(...., context=None,....)
if not context:
context={}
.....
but shouldn't we have instead:
def foo(...., context={},....):
....
Lionel |
Often in the code base we have:
def foo(...., context=None,....)
As explained in comment #1, this should be changed to
def foo(...., context={},....):
if not context:
context={}
....
(This bug originally proposed the other way round hence the "nope" in comment #1.) |
|
2010-02-22 16:15:19 |
Numérigraphe |
description |
Often in the code base we have:
def foo(...., context=None,....)
As explained in comment #1, this should be changed to
def foo(...., context={},....):
if not context:
context={}
....
(This bug originally proposed the other way round hence the "nope" in comment #1.) |
Often in the code base we have:
def foo(...., context={},....):
As explained in comment #1, this should be changed to
def foo(...., context=None,....):
if not context:
context={}
....
(This bug originally proposed the other way round hence the "nope" in comment #1.)
|
|
2010-02-22 16:15:40 |
Numérigraphe |
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,....):
if not context:
context={}
....
(This bug originally proposed the other way round hence the "nope" in comment #1.)
|
Often in the code base we have:
def foo(...., context={},....):
....
As explained in comment #1, this should be changed to
def foo(...., context=None,....):
if not context:
context={}
....
(This bug originally proposed the other way round hence the "nope" in comment #1.)
|
|
2010-02-22 16:17:08 |
Numérigraphe |
openobject-addons: status |
Invalid |
Confirmed |
|
2010-02-22 16:18:38 |
Numérigraphe |
nominated for series |
|
openobject-addons/4.2 |
|
2010-02-22 16:18:38 |
Numérigraphe |
nominated for series |
|
openobject-addons/5.0 |
|
2010-02-22 16:18:38 |
Numérigraphe |
nominated for series |
|
openobject-addons/trunk |
|
2010-02-22 16:18:38 |
Numérigraphe |
nominated for series |
|
openobject-addons/extra-trunk |
|
2010-02-22 16:18:38 |
Numérigraphe |
nominated for series |
|
openobject-addons/extra-5.0 |
|
2010-02-22 16:41:32 |
Numérigraphe |
summary |
Default Context should be None in methods/functions |
Default values should be immutable |
|
2010-02-22 16:44:40 |
Numérigraphe |
bug task added |
|
openobject-server |
|
2010-02-22 16:45:12 |
Numérigraphe |
nominated for series |
|
openobject-server/5.0 |
|
2010-02-22 16:45:12 |
Numérigraphe |
nominated for series |
|
openobject-server/trunk |
|
2010-02-22 21:26:12 |
Xavier (Open ERP) |
bug task added |
|
openobject-addons/trunk |
|
2010-02-22 21:26:20 |
Xavier (Open ERP) |
bug task added |
|
openobject-addons/extra-trunk |
|
2010-02-22 21:26:36 |
Xavier (Open ERP) |
bug task added |
|
openobject-server/trunk |
|
2010-02-23 09:10:57 |
Xavier (Open ERP) |
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,....):
if not context:
context={}
....
(This bug originally proposed the other way round hence the "nope" in comment #1.)
|
Often in the code base we have:
def foo(...., context={},....):
....
As explained in comment #1, this should be changed to
def foo(...., context=None,....):
if not context:
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. |
|
2010-02-23 09:11:20 |
Xavier (Open ERP) |
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,....):
if not context:
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. |
Often in the code base we have:
def foo(...., context={},....):
....
As explained in comment #1, this should be changed to
def foo(...., context=None,....):
if not context: # test incorrect, see below
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.
|
|
2010-02-25 15:28:21 |
Numérigraphe |
attachment added |
|
First draft for a script to fix default values in a source file http://launchpadlibrarian.net/39781315/fix_default_values.py |
|
2010-02-25 15:32:46 |
Numérigraphe |
attachment added |
|
Sample diff generated by the script http://launchpadlibrarian.net/39781472/default-addons.diff.gz |
|
2010-02-27 10:08:52 |
Numérigraphe |
attachment added |
|
Improved script to fix http://launchpadlibrarian.net/39850935/fix_default_values.py |
|
2010-02-27 10:10:31 |
Numérigraphe |
attachment removed |
First draft for a script to fix default values in a source file http://launchpadlibrarian.net/39781315/fix_default_values.py |
|
|
2010-02-27 10:11:43 |
Numérigraphe |
attachment removed |
Sample diff generated by the script http://launchpadlibrarian.net/39781472/default-addons.diff.gz |
|
|
2010-02-27 10:14:48 |
Numérigraphe |
attachment added |
|
New sample patch for the trunk addons http://launchpadlibrarian.net/39851024/addons-defaults.diff.gz |
|
2010-03-10 11:06:27 |
Numérigraphe |
attachment removed |
Improved script to fix http://launchpadlibrarian.net/39850935/fix_default_values.py |
|
|
2010-03-10 11:06:44 |
Numérigraphe |
attachment removed |
New sample patch for the trunk addons http://launchpadlibrarian.net/39851024/addons-defaults.diff.gz |
|
|
2010-03-10 11:09:05 |
Numérigraphe |
attachment added |
|
Script to help developpers fix this bug http://launchpadlibrarian.net/40684475/fix_default_values.py |
|
2010-03-10 11:11:46 |
Numérigraphe |
attachment added |
|
Sample patch produced by the script http://launchpadlibrarian.net/40684661/new.diff |
|
2010-03-10 12:56:32 |
Numérigraphe |
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,....):
if not context: # test incorrect, see below
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.
|
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.
|
|
2010-04-21 14:30:43 |
Numérigraphe |
bug task added |
|
openobject-client |
|
2010-04-21 14:30:56 |
Numérigraphe |
openobject-client: status |
New |
Confirmed |
|
2010-04-21 14:33:21 |
Numérigraphe |
tags |
|
context refactoring |
|
2010-07-22 13:57:45 |
Numérigraphe |
openobject-server/trunk: status |
New |
Confirmed |
|
2010-07-22 14:00:54 |
Launchpad Janitor |
branch linked |
|
lp:~numerigraphe/openobject-server/bug525808-mutable-defaults-trunk |
|
2010-11-08 11:48:38 |
tfr (Openerp) |
openobject-addons/extra-trunk: importance |
Undecided |
Low |
|
2010-11-08 11:48:44 |
tfr (Openerp) |
openobject-client: importance |
Undecided |
Low |
|
2010-11-08 11:48:51 |
tfr (Openerp) |
openobject-server/trunk: importance |
Undecided |
Low |
|
2010-11-08 11:48:55 |
tfr (Openerp) |
openobject-addons/trunk: importance |
Undecided |
Low |
|
2010-11-08 11:49:14 |
tfr (Openerp) |
openobject-addons/trunk: assignee |
|
OpenERP R&D Addons Team 2 (openerp-dev-addons2) |
|
2010-11-08 11:49:33 |
tfr (Openerp) |
openobject-client: assignee |
|
OpenERP sa GTK client R&D (openerp-dev-gtk) |
|
2010-11-08 11:50:34 |
tfr (Openerp) |
openobject-server/trunk: assignee |
|
Olivier Dony (OpenERP) (odo) |
|
2010-11-09 08:08:07 |
Fabien (Open ERP) |
openobject-client: status |
Confirmed |
Invalid |
|
2010-11-09 15:52:04 |
Numérigraphe |
openobject-client: status |
Invalid |
Opinion |
|
2010-11-10 10:16:07 |
Numérigraphe |
tags |
context refactoring |
context long-term refactoring |
|
2010-11-12 09:17:49 |
Olivier Dony (Odoo) |
openobject-addons/extra-trunk: status |
New |
Opinion |
|
2010-11-12 18:11:28 |
Launchpad Janitor |
branch linked |
|
lp:openobject-server |
|
2010-11-12 18:11:38 |
Olivier Dony (Odoo) |
openobject-server/trunk: status |
Confirmed |
Fix Released |
|
2010-11-12 18:11:38 |
Olivier Dony (Odoo) |
openobject-server/trunk: assignee |
Olivier Dony (OpenERP) (odo) |
|
|
2010-11-15 15:21:02 |
qdp (OpenERP) |
openobject-addons/trunk: status |
Confirmed |
Opinion |
|
2012-03-05 18:33:38 |
Numérigraphe |
branch linked |
|
lp:~numerigraphe/openobject-addons/trunk-unmutable-defaults |
|
2012-10-02 11:54:34 |
Numérigraphe |
branch linked |
|
lp:~openerp-dev/openobject-addons/trunk-unmutable-defaults-abo |
|