a guest Feb 17th, 2012 295 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- '''Exercise 1 Classes'''
- class PoetryProtocol(Protocol):
- poem = ''
- def dataReceived(self, data):
- self.poem += data
- def connectionLost(self, reason):
- if self.delayedTimeout.active():
- def poemReceived(self, poem):
- def connectionMade(self):
- self.delayedTimeout = reactor.callLater(7, self.timeout, Failure(TimeoutException))
- def timeout(self, failure):
- class TimeoutException(Exception):
- def __init__(self):
- self.message = "timeout exception how exciting"
- def __str__(self):
- return repr(self.message)
RAW Paste Data