本文整理匯總了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)
示例2: getSpartaDir
# 需要導入模塊: import Files [as 別名]
# 或者: from Files import getSpartaDir [as 別名]
def getSpartaDir():
return Files.getSpartaDir()