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


Python Message.__init__方法代码示例

本文整理汇总了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
开发者ID:AKAfreaky,项目名称:POSH,代码行数:10,代码来源:generic.py

示例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))
开发者ID:BackupTheBerlios,项目名称:pysma-svn,代码行数:12,代码来源:actionAgent.py

示例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']
开发者ID:lastaardvark,项目名称:Owl,代码行数:13,代码来源:smsMessage.py

示例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 = []
开发者ID:lastaardvark,项目名称:Owl,代码行数:13,代码来源:imConversation.py

示例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)
开发者ID:lastaardvark,项目名称:Owl,代码行数:26,代码来源:emailMessage.py

示例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)
开发者ID:bengheng,项目名称:SEAL,代码行数:74,代码来源:usermsg.py

示例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'
开发者ID:cbabalis,项目名称:Elita,代码行数:8,代码来源:signals.py

示例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
开发者ID:BrendanBenshoof,项目名称:CHRONUS,代码行数:7,代码来源:shelver.py

示例9: __init__

# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import __init__ [as 别名]
 def __init__(self, type):
     Message.__init__(self, "MINER", type)
开发者ID:BrendanBenshoof,项目名称:P2PDNS,代码行数:4,代码来源:minerServ.py

示例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
开发者ID:habbes,项目名称:room13-prototype,代码行数:5,代码来源:response.py

示例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
开发者ID:BrendanBenshoof,项目名称:CHRONUS,代码行数:8,代码来源:cfs.py

示例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
开发者ID:BrendanBenshoof,项目名称:P2PDNS,代码行数:8,代码来源:httpservice.py

示例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
开发者ID:BrendanBenshoof,项目名称:P2PDNS,代码行数:6,代码来源:sec_service.py


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