pass self.type = ExceptionLikeString self.type.__module__ = ".".join(typepieces[:-1]) self.type.__name__ = typepieces[-1] def __str__(self): return "[CopiedFailure instance: %s]" % self.getBriefTraceback() pickled = 1 def printTraceback(self, file=None, elideFrameworkCode=0, detail='default'): if file is None: file = log.logerr file.write("Traceback from remote host -- ") file.write(self.traceback) copyable.registerRemoteCopy(FailureSlicer.classname, CopiedFailure) class CopiedFailureSlicer(FailureSlicer): # A calls B. B calls C. C fails and sends a Failure to B. B gets a # CopiedFailure and sends it to A. A should get a CopiedFailure too. This # class lives on B and slices the CopiedFailure as it is sent to A. slices = CopiedFailure def getStateToCopy(self, obj, broker): state = {} for k in ('value', 'type', 'parents'): state[k] = getattr(obj, k) if broker.unsafeTracebacks: state['traceback'] = obj.traceback else: state['traceback'] = "Traceback unavailable\n"
class ExceptionLikeString: pass self.type = ExceptionLikeString self.type.__module__ = ".".join(typepieces[:-1]) self.type.__name__ = typepieces[-1] def __str__(self): return "[CopiedFailure instance: %s]" % self.getBriefTraceback() pickled = 1 def printTraceback(self, file=None, elideFrameworkCode=0, detail='default'): if file is None: file = twlog.logerr file.write("Traceback from remote host -- ") file.write(self.traceback) copyable.registerRemoteCopy(FailureSlicer.classname, CopiedFailure) class CopiedFailureSlicer(FailureSlicer): # A calls B. B calls C. C fails and sends a Failure to B. B gets a # CopiedFailure and sends it to A. A should get a CopiedFailure too. This # class lives on B and slices the CopiedFailure as it is sent to A. slices = CopiedFailure def getStateToCopy(self, obj, broker): state = {} for k in ('value', 'type', 'parents'): state[k] = getattr(obj, k) if broker.unsafeTracebacks: state['traceback'] = obj.traceback else: