本文整理汇总了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()
示例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)
示例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)