0001-misc-add-dedicated-methods-for-copy-and-deepcopy-240.patch
wcs/formdef.py | ||
---|---|---|
1328 | 1328 |
if changed: |
1329 | 1329 |
formdef.store() |
1330 | 1330 | |
1331 |
class _EmptyClass(object): # helper for instance creation without calling __init__ |
|
1332 |
pass |
|
1333 | ||
1334 |
def __copy__(self, memo=None, deepcopy=False): |
|
1335 |
formdef_copy = self._EmptyClass() |
|
1336 |
formdef_copy.__class__ = self.__class__ |
|
1337 |
if deepcopy: |
|
1338 |
formdef_copy.__dict__ = copy.deepcopy(self.__dict__, memo=memo) |
|
1339 |
else: |
|
1340 |
formdef_copy.__dict__ = copy.copy(self.__dict__) |
|
1341 |
return formdef_copy |
|
1342 | ||
1343 |
def __deepcopy__(self, memo=None): |
|
1344 |
return self.__copy__(memo=memo, deepcopy=True) |
|
1345 | ||
1331 | 1346 |
# don't pickle computed attributes |
1332 | 1347 |
def __getstate__(self): |
1333 | 1348 |
odict = copy.copy(self.__dict__) |
1334 |
- |