On 2016-11-17 09:55, Albert Cervera i Areny wrote: > > - find better than deepcopy: > > http://hg.tryton.org/trytond/file/default/trytond/model/model.py#l46 > > I'm not sure of what I'll say, but AFAIU deepcopy is used to support > several databases (with different modules). Would it be possible to > pass a "--single-database" parameter to trytond, so it would just > support a single database but it would also avoid deepcopying? Or is > there much more work than that?
It is not only for multi-database. For example, a common pattern (which probably should be removed) is to have a global variable STATES which is used in Selection. If another module extend the Selection field, we do not want it to change the global STATES variable. Indeed what I was suggesting is not to remove the feature because it is quite convenient (remember old version where copy should be done on any modified field attribute). I think the deepcopy could be improved by limiting what is copied. This could be done by creating __copy__ method on fields (like: Function and Property). But first, it has to be proven that deepcopy on this case is slow and memory consuming. -- Cédric Krier - B2CK SPRL Email/Jabber: cedric.kr...@b2ck.com Tel: +32 472 54 46 59 Website: http://www.b2ck.com/ -- You received this message because you are subscribed to the Google Groups "tryton-dev" group. To view this discussion on the web visit https://groups.google.com/d/msgid/tryton-dev/20161117092509.GT16659%40tetsuo.