def __deepcopy__(self, memo): ''' Deepcopy the object. If `DontCopyPersistent` is given, only mock-copy. When this method receieves an instance of `DontCopyPersistent` as a memo dictionary, it will not actually deepcopy the object but only return a reference to the original object. ''' if isinstance(memo, DontCopyPersistent): memo[id(self)] = self return self else: new_copy = copy_tools.deepcopy_as_simple_object(self, memo) return new_copy
def __deepcopy__(self, memo): ''' Deepcopy the object. If `DontCopyPersistent` is given, only mock-copy. When this method receieves an instance of `DontCopyPersistent` as a memo dictionary, it will not actually `deepcopy` the object but only return a reference to the original object. ''' if isinstance(memo, DontCopyPersistent): memo[id(self)] = self return self else: new_copy = copy_tools.deepcopy_as_simple_object(self, memo) new_copy._Persistent__uuid = uuid.uuid4() try: del self.personality except AttributeError: pass return new_copy