當前位置: 首頁>>代碼示例>>Python>>正文


Python Files.getSpartaDir方法代碼示例

本文整理匯總了Python中Files.getSpartaDir方法的典型用法代碼示例。如果您正苦於以下問題:Python Files.getSpartaDir方法的具體用法?Python Files.getSpartaDir怎麽用?Python Files.getSpartaDir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Files的用法示例。


在下文中一共展示了Files.getSpartaDir方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: sendMessage

# 需要導入模塊: import Files [as 別名]
# 或者: from Files import getSpartaDir [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

示例2: getSpartaDir

# 需要導入模塊: import Files [as 別名]
# 或者: from Files import getSpartaDir [as 別名]
def getSpartaDir():		   
	return Files.getSpartaDir()
開發者ID:onetera,項目名稱:sp,代碼行數:4,代碼來源:__init__.py


注:本文中的Files.getSpartaDir方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。