openerp-expert-framework team mailing list archive
-
openerp-expert-framework team
-
Mailing list archive
-
Message #00099
Removing context
[Following with my series of sensationalist subjects]
In the partners mailing list, I've read that Fabien mentions the new release
of OpenERP as 5.2 or 6.0. If that was to be called 6.0 I think more things
should be fixed so let me make a proposal which will most probably be rejected
;-)
The proposal is to change the usual structure:
def function(self, cr, uid, .... context=None):
with
def function(self, session, ...):
This session variable could have at least three members:
session.cr
session.uid
session.context
It could provide some facilities such as:
newsession = session.copy()
or
# copy updating context
newsession = session.copy({
'lang': 'ca_ES'
})
I know that sounds like a big change but I can't avoid thinking on how many
bug reports we would have avoided (and will avoid) just because developers
keep forgeting passing context argument.
It's true that there're lots of modules out there but most of them could be
updated with simple regular expressions.
Of course, it also provides cleaner code and avoids typing a little bit of
code :P
--
Albert Cervera i Areny
http://www.NaN-tic.com
Mòbil: +34 669 40 40 18
Follow ups