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


Python Element.attributes["xmlns"]方法代码示例

本文整理汇总了Python中twisted.words.xish.domish.Element.attributes["xmlns"]方法的典型用法代码示例。如果您正苦于以下问题:Python Element.attributes["xmlns"]方法的具体用法?Python Element.attributes["xmlns"]怎么用?Python Element.attributes["xmlns"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.words.xish.domish.Element的用法示例。


在下文中一共展示了Element.attributes["xmlns"]方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: removeListEntry

# 需要导入模块: from twisted.words.xish.domish import Element [as 别名]
# 或者: from twisted.words.xish.domish.Element import attributes["xmlns"] [as 别名]
	def removeListEntry(self, type, jabberID, legacyID):
		""" Removes a legacy ID entry from a list in
		the XDB, based off the type and jabberID you provide. """
		if type != "roster": return
		xdbns = XDBNS_PREFIX+type
		list = self.request(jabberID, xdbns)
		if list == None:
			list = Element((None, "aimtrans"))
			list.attributes["xmlns"] = xdbns

		buddies = None
		for child in list.elements():
			try:
				if child.name == "buddies":
					buddies = child
					break
			except AttributeError:
				continue

		if buddies == None:
			buddies = list.addElement("buddies")

		# Remove the existing element
		for child in buddies.elements():
			try:
				if child.getAttribute("name") == legacyID:
					buddies.children.remove(child)
			except AttributeError:
				continue

		self.set(jabberID, xdbns, list)
开发者ID:Ashaman-,项目名称:pyaimt,代码行数:33,代码来源:legacyaimtransport.py

示例2: sendPresence

# 需要导入模块: from twisted.words.xish.domish import Element [as 别名]
# 或者: from twisted.words.xish.domish.Element import attributes["xmlns"] [as 别名]
	def sendPresence(self, tojid=None):
		avatarHash = ""
		if self.avatar and not config.disableAvatars:
			avatarHash = self.avatar.getImageHash()
		caps = Element((None, "c"))
		caps.attributes["xmlns"] = globals.CAPS
		caps.attributes["node"] = legacy.url + "/protocol/caps"
		caps.attributes["ver"] = legacy.version
		if not tojid:
			tojid=self.contactList.session.jabberID
		self.contactList.session.sendPresence(to=tojid, fro=self.jid, ptype=self.ptype, show=self.show, status=self.status, avatarHash=avatarHash, nickname=self.nickname, payload=[caps], url=self.url)
开发者ID:Ashaman-,项目名称:pyaimt,代码行数:13,代码来源:contact.py

示例3: formRegEntry

# 需要导入模块: from twisted.words.xish.domish import Element [as 别名]
# 或者: from twisted.words.xish.domish.Element import attributes["xmlns"] [as 别名]
	def formRegEntry(self, username, password):
		""" Returns a domish.Element representation of the data passed. This element will be written to the XDB spool file """
		reginfo = Element((None, "query"))
		reginfo.attributes["xmlns"] = XDBNS_REGISTER

		userEl = reginfo.addElement("username")
		userEl.addContent(username)

		if config.xdbDriver_xmlfiles.get("format","") == "encrypted":
			passEl = reginfo.addElement("encpassword")
			passEl.addContent(utils.encryptPassword(password))
		else:
			passEl = reginfo.addElement("password")
			passEl.addContent(password)

		return reginfo
开发者ID:fritteli,项目名称:pyicqt,代码行数:18,代码来源:legacyjittransport.py

示例4: setSetting

# 需要导入模块: from twisted.words.xish.domish import Element [as 别名]
# 或者: from twisted.words.xish.domish.Element import attributes["xmlns"] [as 别名]
	def setSetting(self, jabberID, variable, value):
		""" Sets a user setting in the XDB. """
		prefs = self.request(jabberID, XDBNS_PREFERENCES)
		if prefs == None:
			prefs = Element((None, "query"))
			prefs.attributes["xmlns"] = XDBNS_PREFERENCES

		# Remove the existing element
		for child in prefs.elements():
			if child.name == variable:
				prefs.children.remove(child)

		newpref = prefs.addElement(variable)
		newpref.addContent(value)

		self.set(jabberID, XDBNS_PREFERENCES, prefs)
开发者ID:Ashaman-,项目名称:pyaimt,代码行数:18,代码来源:xmlfiles.py

示例5: removeListEntry

# 需要导入模块: from twisted.words.xish.domish import Element [as 别名]
# 或者: from twisted.words.xish.domish.Element import attributes["xmlns"] [as 别名]
	def removeListEntry(self, type, jabberID, legacyID):
		""" Removes a legacy ID entry from a list in
		the XDB, based off the type and jabberID you provide. """
		xdbns = XDBNS_PREFIX+type
		list = self.request(jabberID, xdbns)
		if list == None:
			list = Element((None, "query"))
			list.attributes["xmlns"] = xdbns

		# Remove the element
		for child in list.elements():
			try:
				if child.getAttribute("jid") == legacyID:
					list.children.remove(child)
			except AttributeError:
				continue

		self.set(jabberID, xdbns, list)
开发者ID:Ashaman-,项目名称:pyaimt,代码行数:20,代码来源:xmlfiles.py

示例6: setCSetting

# 需要导入模块: from twisted.words.xish.domish import Element [as 别名]
# 或者: from twisted.words.xish.domish.Element import attributes["xmlns"] [as 别名]
	def setCSetting(self, jabberID, variable, value):
		""" Sets a custom user setting in the XDB. """
		# TODO: may be merge with setSetting? It more safe way for storing in XML as I think
		prefs = self.request(jabberID, XDBNS_CSETTINGS)
		if prefs == None:
			prefs = Element((None, "query"))
			prefs.attributes["xmlns"] = XDBNS_CSETTINGS

		# Remove the existing element
		for child in prefs.elements():
			if child.name == 'item' and child.getAttribute('variable') == str(variable):
				prefs.children.remove(child)

		newpref = prefs.addElement('item')
		newpref.attributes['variable'] = str(variable)
		newpref.addContent(value)

		self.set(jabberID, XDBNS_CSETTINGS, prefs)
开发者ID:anton-ryzhov,项目名称:pyicqt_auto_reconnect,代码行数:20,代码来源:xmlfiles.py

示例7: formRegEntry

# 需要导入模块: from twisted.words.xish.domish import Element [as 别名]
# 或者: from twisted.words.xish.domish.Element import attributes["xmlns"] [as 别名]
	def formRegEntry(self, username, password):
		""" Returns a domish.Element representation of the data passed. This element will be written to the XDB spool file """
		reginfo = Element((None, "aimtrans"))

		logoninfo = reginfo.addElement("logon")
		logoninfo.attributes["id"] = username
		logoninfo.attributes["pass"] = password

		return reginfo

		reginfo = Element((None, "query"))
		reginfo.attributes["xmlns"] = XDBNS_REGISTER

		userEl = reginfo.addElement("username")
		userEl.addContent(username)

		passEl = reginfo.addElement("password")
		passEl.addContent(password)

		return reginfo
开发者ID:Ashaman-,项目名称:pyaimt,代码行数:22,代码来源:legacyaimtransport.py

示例8: setListEntry

# 需要导入模块: from twisted.words.xish.domish import Element [as 别名]
# 或者: from twisted.words.xish.domish.Element import attributes["xmlns"] [as 别名]
	def setListEntry(self, type, jabberID, legacyID, payload = {}):
		""" Updates or adds a legacy ID entry to a list in
		the XDB, based off the type and jabberID you provide. """
		xdbns = XDBNS_PREFIX+type
		list = self.request(jabberID, xdbns)
		if list == None:
			list = Element((None, "query"))
			list.attributes["xmlns"] = xdbns

		# Remove the existing element
		for child in list.elements():
			try:
				if child.getAttribute("jid") == legacyID:
					list.children.remove(child)
			except AttributeError:
				continue

		newentry = list.addElement("item")
		newentry["jid"] = legacyID
		for p in payload.keys():
			newentry[p] = payload[p]

		self.set(jabberID, xdbns, list)
开发者ID:Ashaman-,项目名称:pyaimt,代码行数:25,代码来源:xmlfiles.py

示例9: setXstatusText

# 需要导入模块: from twisted.words.xish.domish import Element [as 别名]
# 或者: from twisted.words.xish.domish.Element import attributes["xmlns"] [as 别名]
    def setXstatusText(self, jabberID, number, title, desc):
        """ Sets a latest title and desc for x-status with specific number """
        xstatuses = self.request(jabberID, XDBNS_XSTATUSES)
        if xstatuses == None:
            xstatuses = Element((None, "query"))
            xstatuses.attributes["xmlns"] = XDBNS_XSTATUSES

        # Remove the existing element
        for child in xstatuses.elements():
            if child.name == 'item' and child.getAttribute('number') == str(number):
                xstatuses.children.remove(child)

        xstatus = xstatuses.addElement('item')
        xstatus.attributes['number'] = str(number)
        if title:
            xstatus.attributes['title'] = str(title)
        else:
            xstatus.attributes['title'] = ''
        if desc:
            xstatus.addContent(str(desc))
        else:
            xstatus.addContent('')

        self.set(jabberID, XDBNS_XSTATUSES, xstatuses)
开发者ID:2mf,项目名称:pyicqt,代码行数:26,代码来源:xmlfiles.py


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