当前位置: 首页>>代码示例>>Python>>正文


Python Login.getName方法代码示例

本文整理汇总了Python中Login.getName方法的典型用法代码示例。如果您正苦于以下问题:Python Login.getName方法的具体用法?Python Login.getName怎么用?Python Login.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Login的用法示例。


在下文中一共展示了Login.getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getLoginName

# 需要导入模块: import Login [as 别名]
# 或者: from Login import getName [as 别名]
def getLoginName():
	return Login.getName()
开发者ID:onetera,项目名称:sp,代码行数:4,代码来源:__init__.py

示例2: sendMessage

# 需要导入模块: import Login [as 别名]
# 或者: from Login import getName [as 别名]
def sendMessage( receiver, receiverCC, receiverBCC, subject, content, attachments=None, withSMS=None ):
	""" 쪽지함에 쪽지를 발송"""
	
	#[TODO] IF not logined !!

	withEmail = True

	emailList = []
	smsList = []
	msgIDXs = []

	receiverTo = getReceiver(receiver)
	receiverCc = getReceiver(receiverCC)
	receiverBcc = getReceiver(receiverBCC)
	
	# 쪽지 내용 저장
	msg = Msg()
	msg.SenderID = unicode(Login.getID())
	msg.SenderName = unicode(Login.getName())
	msg.Subject = unicode(subject)
	msg.Content = unicode(content)
	msg.withSMS = unicode(withSMS)
	msg.CreateDate = datetime.datetime.now() 
	
	Session.add(msg)
	Session.commit()
	
	# To들에게 보내기
	setMsgReceiver(receiverTo, msg.idx, "0")
	# CC들에게 보내기
	setMsgReceiver(receiverCc, msg.idx, "1")
	# BCC들에게 보내기
	setMsgReceiver(receiverBcc, msg.idx, "2")

	# SMS 발송 관련 처리
	if withSMS:
		smsList = list()
		receiverList = receiverTo + receiverCc +receiverBcc
		for msg_receiver in receiverList:
			if type(msg_receiver) != dict:
				continue
			smsList.append(msg_receiver["HandPhone"])

		if len(smsList) > 0:
			SMS.send(sendMsg=u"[sparta] %s" % msg.Content[:70], recvList=smsList)
	
	if withEmail:
		senderData = getReceiver("<%s>" % Login.getID())[0]["GwID"]
		emailList = list()
		receiverList = receiverTo + receiverCc +receiverBcc
		for msg_receiver in receiverList:
			if type(msg_receiver) != dict:
				continue			
			if str(msg_receiver["GwID"]).startswith("D"):
				emailList.append( str(msg_receiver["GwID"])+"@idea.co.kr" )
		if len(emailList) > 0:
			sendEmail("%[email protected]" % senderData, msg.Subject, msg.Content, recvList=emailList)
   
	if attachments:
		objUpload = Upload()
		objUpload.MsgInitialize()
		
		for attach_item in attachments:
			new_file = objUpload.upload_file_move(attach_item)

			rowMsgAttach = MsgAttach()
			rowMsgAttach.Msg_IDX = unicode(msg.idx)
			rowMsgAttach.OriginalFileName = unicode(new_file["O_PATH"])
			rowMsgAttach.NewFileName = unicode(new_file["D_PATH"])
			rowMsgAttach.FileSize = unicode(new_file["SIZE"])

			Session.add(rowMsgAttach)

		Session.commit()
	return len(receiverTo)
开发者ID:onetera,项目名称:sp,代码行数:77,代码来源:nMessage.py

示例3: sendMessage

# 需要导入模块: import Login [as 别名]
# 或者: from Login import getName [as 别名]
def sendMessage( receiver, subject, content, attachments=None, withSMS=None ):
	""" 쪽지함에 쪽지를 발송	
	"""
	#[TODO] To,CC,BCC에 대한 처리 필요 
	#[TODO] IF not logined !!
	
	smsList = []
	msgIDXs = []
	msgSave = { "Subject": subject, "Content": content, "Sender": Login.getID(), "SenderName": Login.getName() }
   
	if "<" in receiver:
		#ex) Address Parsing :: "정기영" <[email protected]>, "김태희" <[email protected]>  -> ["[email protected]",  "[email protected]"]
		addrsList = re.findall("\<([._,a-zA-Z0-9:\#\@]+)\>+", receiver)
	else:	 
		addrsList = [n.strip() for n in receiver.split(",")]
	
	for recID in addrsList:
		
		userData = Archive("User").getValues( "User.UserID == "+ recID, "Name,HandPhone" )
		if userData:
			msgSave["Receiver"] = recID
			
			result_IDX = Archive("MsgInBox").New(**msgSave)
			
			if result_IDX:
				msgIDXs.append( result_IDX )
				if userData["HandPhone"] and not userData["HandPhone"].replace("-","") in smsList:
					smsList.append( str(userData["HandPhone"].replace("-","")) )
				
				sentMsg = { "RelateIDX": result_IDX, "Subject": subject, "Content": content, "Receiver": recID, "ReceiverName": userData["Name"], "Sender": Login.getID() } 
				r = Archive("MsgSent").New( **sentMsg )
	
	if attachments:
		#[TODO] 임시 코드입니다. 멀티센딩에서 업된 파일에 대한 레퍼런스 카운트가 이상적이나 일단 그냥 복제형태로 갑니다.
		if type(attachments) == unicode:
			attachments = attachments.encode("utf8")
		
		uploadFile = Files.getRootDir() + attachments
		fileName = os.path.split(attachments)[1]
		
		if os.path.exists( uploadFile ):
			for ridx in msgIDXs:
				if str(ridx).isdigit():
					targetFile = "/data/message/%s.%s" % ( fileName, ridx )
					shutil.copy2( uploadFile, Files.getSpartaDir() + targetFile )
					msgMod = { "IDX" : ridx, "Attachments" : "%s" % fileName }
					r = Archive( "MsgInBox" ).New( **msgMod )
			os.remove(uploadFile)
	
	if withSMS and smsList:		   
		SMS.send( sendMsg=u"스팔타쪽지>"+msgSave["Subject"], recvList=smsList )
	
	return len(msgIDXs)
开发者ID:onetera,项目名称:sp,代码行数:55,代码来源:Message.py


注:本文中的Login.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。