本文整理汇总了Python中message.Message.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Message.__init__方法的具体用法?Python Message.__init__怎么用?Python Message.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类message.Message
的用法示例。
在下文中一共展示了Message.__init__方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import __init__ [as 别名]
def __init__(self,
drive_name = None,
timeout = None,
**kw):
# Call ancestor init with the remaining keywords
Message.__init__(self, **kw)
self.drive_name = drive_name
self.timeout = timeout
示例2: __init__
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import __init__ [as 别名]
def __init__(self, action, arg, kw={}):
""" Action message constructor.
@param action: Type of the action to perform. The name of the handler will depend on the action name.
@type action: C{str}
@param arg: Arguments attached to the action (Empty tuple (C{()}) for none).
@type arg: C{tuple or list}
@param kw: Keywords (optional arguments) attached to the action (Empty dictionnary (C{E{lb}E{rb}}) for none).
@type kw: C{dict}
"""
Message.__init__(self, (action, arg, kw))
示例3: __init__
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import __init__ [as 别名]
def __init__(self, db, fields):
"""
Initializes a new Sms using a dictionary
of database fields.
"""
Message.__init__(self, db, fields)
self.remoteId = fields['intSmsRemoteId']
self.text = fields['strSmsText']
示例4: __init__
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import __init__ [as 别名]
def __init__(self, db, fields):
"""
Initializes a new IM conversation using a dictionary
of database fields.
"""
Message.__init__(self, db, fields)
self.remoteId = fields['strIMRemoteId']
self.entries = []
示例5: __init__
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import __init__ [as 别名]
def __init__(self, db, fields):
"""
Initializes a new Email using a dictionary
of database fields.
"""
fields['strMessageType'] = 'imap'
Message.__init__(self, db, fields)
encryptionKey = settings.settings['userDataEncryptionSalt'] + message._password
self.remoteId = fields['intEmailRemoteId']
self.subject = fields['strEmailSubject']
self.bodyPlain = fields['strEmailBodyPlainText']
self.bodyPlain = encryption.decrypt(encryptionKey, self.bodyPlain)
self.bodyHtml = fields['strEmailBodyHtml']
self.bodyHtml = encryption.decrypt(encryptionKey, self.bodyHtml)
if 'strRaw' in fields:
self.raw = fields['strRaw']
self.raw = encryption.decrypt(encryptionKey, self.raw)
示例6: __init__
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import __init__ [as 别名]
def __init__(self, msgfile, userdir=None, images=None, **keywords):
Message.__init__(self)
msgheaders = []
if userdir is None:
userdir = cfgdata.USERDIR
try:
f = open(os.path.join(userdir, msgfile), 'r')
# File can start with comments, denoted by a starting # sign;
curline = f.readline()
while curline and curline[0].strip() == '#':
curline = f.readline()
# Then comes the header fields, concluded with a '--' line;
while curline and curline.strip() != '--':
curline = curline.strip()
headerpair = curline.split(':',1)
if len(headerpair) == 2:
hdrname, hdrval = headerpair
hdrname = hdrname.strip()
hdrval = hdrval.strip()
hdrval = Template(hdrval).safe_substitute(**keywords)
msgheaders.append( (hdrname, hdrval) )
curline = f.readline()
else:
logging.warning('User message "%s" contains improperly formatted '
'header: "%s"', msgfile, curline)
raise
# The rest will be the message body;
if curline:
msgdata = f.read().strip()
msgdata = Template(msgdata).safe_substitute(**keywords)
else:
msgdata = ""
except:
logging.info('Could not open user message file')
raise
# Compose user response message;
if images == None:
rawmsg = MIMEText(msgdata)
else:
txtmsg = MIMEText(msgdata)
rawmsg = MIMEMultipart()
rawmsg.attach(txtmsg)
# Attach images
for imgfile in images:
# image paths should probably be taken relative to userdir;
# imgfile = os.path.join(userdir, imgfile)
fp = open(imgfile, 'rb')
img = MIMEImage(fp.read())
fp.close()
rawmsg.attach(img)
self.set_payload(rawmsg.get_payload())
for hdr in rawmsg.keys():
self.add_header(hdr, rawmsg[hdr])
for hdr in msgheaders:
self.add_header(*hdr)
示例7: __init__
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import __init__ [as 别名]
def __init__(self, sender, recipient):
"""initializes an ACK message. """
# create an empty message
Message.__init__(self, sender, recipient, [])
# set the signal
self.signal = 'ACK'
示例8: __init__
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import __init__ [as 别名]
def __init__(self, origin_node, backup_pile):
Message.__init__(self, SERVICE_SHELVER, "BACKUP")
self.origin_node = origin_node
self.add_content("backup",backup_pile)
self.reply_to = origin_node
示例9: __init__
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import __init__ [as 别名]
def __init__(self, type):
Message.__init__(self, "MINER", type)
示例10: __init__
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import __init__ [as 别名]
def __init__(self, cmd, content="", *params):
Message.__init__(self, cmd, content, *params)
self.content = content
示例11: __init__
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import __init__ [as 别名]
def __init__(self, origin_node, destination_key, Response_service=SERVICE_CFS, action="GET"):
Message.__init__(self, SERVICE_CFS, action)
self.origin_node = origin_node
self.destination_key = destination_key
self.add_content("service",Response_service)
self.reply_to = origin_node
示例12: __init__
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import __init__ [as 别名]
def __init__(self, origin_node, destination_key, Response_service="WEBSERVICE", file_type="GET"):
Message.__init__(self, SERVICE_SHELVER, file_type)
self.origin_node = origin_node
self.destination_key = destination_key
self.add_content("service",Response_service)
self.reply_to = origin_node
示例13: __init__
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import __init__ [as 别名]
def __init__(self, origin_node, destination_key):
Message.__init__(self, "SEC", "MSG")
self.origin_node = origin_node # node that just sent this message
self.destination_key = destination_key # the key we're trying to find the node responsible for