def connectionLost(self, reason=connectionDone): if not self.finished.called: self.finished.callback(self.content.getvalue())