本文整理匯總了Python中zope.container.interfaces.IReadContainer.values方法的典型用法代碼示例。如果您正苦於以下問題:Python IReadContainer.values方法的具體用法?Python IReadContainer.values怎麽用?Python IReadContainer.values使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類zope.container.interfaces.IReadContainer
的用法示例。
在下文中一共展示了IReadContainer.values方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: children_xmldoc
# 需要導入模塊: from zope.container.interfaces import IReadContainer [as 別名]
# 或者: from zope.container.interfaces.IReadContainer import values [as 別名]
def children_xmldoc(self):
# If you need custom filter then reimplement this method.
# Otherwise this implementation is generic and it is correct
# for standard cases.
try:
rc = IReadContainer(self.context)
except TypeError:
return XMLDOC % u''
except Unauthorized:
return XMLDOC % u''
specs = [queryMultiAdapter((value, self.request), IXML)
for value in rc.values()]
specs = filter(lambda x:x, specs)
specs.sort(key = lambda x: x.sort_key())
nodes = [x.to_xml() for x in specs]
return XMLDOC % u'\n'.join(nodes)
示例2: children_xmldoc
# 需要導入模塊: from zope.container.interfaces import IReadContainer [as 別名]
# 或者: from zope.container.interfaces.IReadContainer import values [as 別名]
def children_xmldoc(self):
try:
rc = IReadContainer(self.context)
except TypeError:
return XMLDOC % u''
except Unauthorized:
return XMLDOC % u''
specs = [queryMultiAdapter((value, self.request), IXML)
for value in rc.values()]
specs = filter(lambda x:x, specs)
specs.sort(key = lambda x: x.sort_key())
nodes = [x.to_xml() for x in specs]
# add ++etc++site
sm = self.context.getSiteManager()
sm_spec = queryMultiAdapter((sm, self.request), IXML)
nodes.append(sm_spec.to_xml())
return XMLDOC % u'\n'.join(nodes)