Improve ModelStorage.copy
* Allow callable in copy default * Support dotted notation in copy default * Use setdefault in copy * Copy default when needed * Do not set default state in copy * Use callable and dotted notation in copy default issue5576 issue7648 review72291002
This commit is contained in:
@@ -171,7 +171,8 @@ class Move(metaclass=PoolMeta):
|
||||
def copy(cls, moves, default=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
default = default.copy()
|
||||
else:
|
||||
default = default.copy()
|
||||
for prefix in ('in_', 'out_'):
|
||||
default.setdefault(prefix + 'anglo_saxon_quantity',
|
||||
getattr(cls, 'default_%sanglo_saxon_quantity' % prefix)())
|
||||
|
||||
Reference in New Issue
Block a user