本文整理汇总了Python中message.Message.msg_status方法的典型用法代码示例。如果您正苦于以下问题:Python Message.msg_status方法的具体用法?Python Message.msg_status怎么用?Python Message.msg_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类message.Message
的用法示例。
在下文中一共展示了Message.msg_status方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: command
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import msg_status [as 别名]
def command(self, cmd):
if cmd == "REQ LIST MACH":
M = Message()
M.msg_status = Message.OK
M.msg_info = "REQ LIST"
M.msg_data = "MACHINE"
self.sendLine(str(M.to_json())+self.delimiter)
elif cmd == "REQ LIST OPER":
M = Message()
M.msg_status = Message.OK
M.msg_info = "REQ LIST"
M.msg_data = "OPERATOR"
self.sendLine(str(M.to_json())+self.delimiter)
else:
self.sendLine(str(cmd))
self.d = defer.Deferred()
return self.d
示例2: test
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import msg_status [as 别名]
def test():
pdb.set_trace()
DEBUG = True
#s = Session()
s = Session_GR()
print "Debut : " , s.prompt()
EXIT = False
while not EXIT:
if DEBUG:
print " %s " % s
reponse = raw_input('>')
if reponse == "REQ LIST OPERATOR":
M = Message()
M.msg_status = Message.OK
M.msg_info = 'REQ LIST'
M.msg_data = 'OPERATOR'
reponse = M.to_json()
if reponse == "REQ LIST MACHINE":
M = Message()
M.msg_status = Message.OK
M.msg_info = 'REQ LIST'
M.msg_data = 'MACHINE'
reponse = M.to_json()
s.set_reponse(reponse)
if s.error():
print "ERREUR : %s " % s.resultat()
else:
print "> %s " % s.resultat()
if s.EXIT:
print "SORTIE ..."
EXIT = True
else:
print s.prompt()
示例3: compute_msg
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import msg_status [as 别名]
def compute_msg(self, Msg):
Ret = Message()
Ret.msg_status = Message.OK
## demande de liste
if Msg.msg_info == 'REQ LIST':
if Msg.msg_data == 'OPERATOR':
Ret.msg_info = 'SEND LIST OPERATOR'
Ret.msg_data = [ 'OPER1', 'OPER2', 'OPER3' ]
self._error = False
elif Msg.msg_data == 'MACHINE':
Ret.msg_info = 'SEND LIST MACHINE'
Ret.msg_data = [ 'MACH1', 'MACH2', 'MACH3' ]
self._error = False
else:
Ret.msg_status = Message.KO
Ret.msg_info = 'SEND LIST'
Ret.msg_data = 'FICHIER INCORRECT'
self._error = True
## Autre chose
else:
Ret.msg_info = 'DEMANDE INCONNUE'
Ret.msg_status = Message.KO
self._error = True
self._resultat = Ret.to_json()