Beispiel #1
0
	def lineReceived(self, line):
		self.resetTimeout()
		self.pauseProducing()

		def allDone(ignored):
			self.resumeProducing()

		spaceIndex = line.find(' ')
		if spaceIndex != -1:
			cmd = line[:spaceIndex]
			args = url.decode_url_string(line[spaceIndex + 1:])
		else:
			cmd = line
			args = {}
		d = defer.maybeDeferred(self.processCommand, cmd, **args)
		d.addCallbacks(self.succeed, self.failed)
		d.addErrback(log.err)

		# XXX It burnsss
		# LineReceiver doesn't let you resumeProducing inside
		# lineReceived atm
		self._callLater(0, d.addBoth, allDone)
Beispiel #2
0
	def __init__(self, raw_response, headers=None):
		self.raw_response = raw_response
		self.headers = headers
		if self.headers is None:
			self.headers = url.decode_url_string(self.raw_response)