From bb4e91aa2e685bf2d5a7d1dea2a548f3713cb36a Mon Sep 17 00:00:00 2001 From: smurail Date: Mon, 22 Sep 2014 17:11:48 +0200 Subject: [PATCH] prevent mess when copying BaseObject instances Note: to understand this fix, see AbstractElement.__init__ -- it calls deepcopy on parent.env, it caused copying of objects we do not want to copy such as thread locks. --- weboob/capabilities/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/weboob/capabilities/base.py b/weboob/capabilities/base.py index f7b3b540..9be8fd08 100644 --- a/weboob/capabilities/base.py +++ b/weboob/capabilities/base.py @@ -338,6 +338,9 @@ class BaseObject(object): obj._fields = copy(self._fields) return obj + def __deepcopy__(self, memo): + return self.copy() + def set_empty_fields(self, value, excepts=()): """ Set the same value on all empty fields.