本文整理汇总了Python中Data.regist方法的典型用法代码示例。如果您正苦于以下问题:Python Data.regist方法的具体用法?Python Data.regist怎么用?Python Data.regist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data.regist方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onNetworkRecv
# 需要导入模块: import Data [as 别名]
# 或者: from Data import regist [as 别名]
def onNetworkRecv(self,data):
#on first hand
CMDN=Data.CMD_NETWORK_HAND()
print "recv:",data
if data!="" and data!=None:
ds=data.split(Data.CMD_SPLIT)
if len(ds)>1:
if not self.isRegist:
if ds[0]==CMDN.login:
loginMsg=""
suc=False
u=None
print ds[1],ds[2]
print Data.login(ds[1],ds[2])
try:
suc,u,loginMsg=Data.login(ds[1],ds[2])
print "suc,u,loginMsg",suc,u,loginMsg
except Exception as e:
print e
loginMsg="get bad login value"
print suc
if suc:
self.user=u
self.isRegist=True
self.sendMsg(CMDN.verify,loginMsg)
self.sendMsg(CMDN.msg,loginMsg)
else:
self.sendMsg(CMDN.msg,loginMsg)
elif ds[0]==CMDN.regist:
regMsg=""
suc=False
u=None
try:
suc,u,regMsg=Data.regist(ds[1],ds[2])
print "suc,u,regMsg",suc,u,regMsg
except Exception as e:
print e
if suc:
self.user=u
self.isRegist=True
self.sendMsg(CMDN.verify,regMsg)
self.sendMsg(CMDN.msg,regMsg)
for s in Data.REGISTER_USERS:
self.sendFrendToUser(s)
else:
self.sendMsg(CMDN.msg,regMsg)
else:
if ds[0]==CMDN.say:
if len(ds)==2:
print "broadcastMsg",ds[1]
self.broadcastMsg(self.user,ds[1])
else:
print "say what?"
elif ds[0]==CMDN.fileStart:
if len(ds)==2:
self.recvByteSize=ds[1]
else:
print "say what?"
elif ds[0]==CMDN.fileEnd:
if len(ds)==3:
self.strData[ds[1]]=ds[2]
self.recvByteSize=1025
print self.strData[ds[1]]
else:
()#...