本文整理汇总了Python中cia.LibCIA.XML.digValue方法的典型用法代码示例。如果您正苦于以下问题:Python XML.digValue方法的具体用法?Python XML.digValue怎么用?Python XML.digValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cia.LibCIA.XML
的用法示例。
在下文中一共展示了XML.digValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: format_generator
# 需要导入模块: from cia.LibCIA import XML [as 别名]
# 或者: from cia.LibCIA.XML import digValue [as 别名]
def format_generator(self, gen):
"""Format the information contained in this message's <generator> tag"""
name = XML.digValue(gen, str, "name")
url = XML.digValue(gen, str, "url")
version = XML.digValue(gen, str, "version")
if url:
name = tag('a', href=url)[ name ]
items = ["Generated by ", Template.value[ name ]]
if version:
items.extend([" version ", version])
return items
示例2: joinMessage
# 需要导入模块: from cia.LibCIA import XML [as 别名]
# 或者: from cia.LibCIA.XML import digValue [as 别名]
def joinMessage(self, message, packages):
content = []
branch = XML.digValue(message.xml, str, "message", "source", "branch")
if branch:
content.append(Nouvelle.tag('strong')[ self.format_branch(branch.strip()) ])
for package in packages:
if content:
content.append(Nouvelle.tag('br'))
content.append(package)
return content
示例3: render_item
# 需要导入模块: from cia.LibCIA import XML [as 别名]
# 或者: from cia.LibCIA.XML import digValue [as 别名]
def render_item(self, context, id, content):
url = Link.MessageLink(self.target, id).getURL(context)
m = Message.Message(content)
tags = [
tag('link')[ url ],
tag('dc:date')[ TimeUtil.formatDateISO8601(XML.digValue(m.xml, int, "message", "timestamp")) ],
tag('description')[ quote(self.formatMessage(m)) ],
]
# Generate a title if we can, but if we can't don't worry too much
try:
tags.append(tag('title')[ Formatters.getFactory().findMedium('title', m).formatMessage(m) ])
except Message.NoFormatterError:
pass
return tag('item', **{'rdf:about': url})[tags]
示例4: messageToItemContent
# 需要导入模块: from cia.LibCIA import XML [as 别名]
# 或者: from cia.LibCIA.XML import digValue [as 别名]
def messageToItemContent(self, context, m, id):
"""Render an XML message as the content of an RSS <item>"""
url = Link.MessageLink(self.target, id).getURL(context)
tags = [
tag('pubDate')[ TimeUtil.formatDateRFC822(XML.digValue(m.xml, int, "message", "timestamp")) ],
tag('guid')[url],
tag('link')[url],
tag('description')[ quote(self.formatMessage(m)) ],
]
# Generate a title if we can, but if we can't don't worry too much
try:
tags.append(tag('title')[ Formatters.getFactory().findMedium('title', m).formatMessage(m) ])
except Message.NoFormatterError:
pass
return tags
示例5: getValue
# 需要导入模块: from cia.LibCIA import XML [as 别名]
# 或者: from cia.LibCIA.XML import digValue [as 别名]
def getValue(self, message):
try:
return XML.digValue(message.xml, int, "message", "timestamp")
except ValueError:
return None