Пример #1
0
	def lineReceived(self, line):
		command = json.loads(line)

		try:
			return_id = command[0]
			command_name = command[1]
			args = command[2:]

			if command_name == commands._return:
				self.cmd_return(return_id, *args)
			else:
				d = maybeDeferred(self.get_command(command_name), self, *args)
				d.addCallback(self.command_complete, return_id)
				d.addErrback(self.command_fail, return_id)

		except Exception, e:
			self.send_command(return_id, commands._return, 1, serialize_error(e))
Пример #2
0
	def command_fail(self, e, return_id):
		e.printTraceback()
		self.send_command(return_id, commands._return, 1, serialize_error(e))