本文整理汇总了Python中Products.CMFCore.CatalogTool.CatalogTool.getMetadataForUID方法的典型用法代码示例。如果您正苦于以下问题:Python CatalogTool.getMetadataForUID方法的具体用法?Python CatalogTool.getMetadataForUID怎么用?Python CatalogTool.getMetadataForUID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products.CMFCore.CatalogTool.CatalogTool
的用法示例。
在下文中一共展示了CatalogTool.getMetadataForUID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_itemCataloguing
# 需要导入模块: from Products.CMFCore.CatalogTool import CatalogTool [as 别名]
# 或者: from Products.CMFCore.CatalogTool.CatalogTool import getMetadataForUID [as 别名]
def test_itemCataloguing(self):
ctool = CatalogTool()
ctool.addColumn('in_reply_to')
getSiteManager().registerUtility(ctool, ICatalogTool)
dtool = self.dtool
test = self._makeDummyContent('test', catalog=1)
test.allow_discussion = 1
self.assertEqual( len(ctool), 1 )
self.failUnless(has_path(ctool, test.getPhysicalPath()))
talkback = dtool.getDiscussionFor(test)
self.assertEqual( talkback.getPhysicalPath(),
('', 'bar', 'site', 'test', 'talkback') )
talkback.createReply( title='test'
, text='blah'
)
self.assertEqual( len(ctool), 2 )
for reply in talkback.getReplies():
self.failUnless(has_path(ctool, reply.getPhysicalPath()))
self.failUnless(has_path(ctool, '/bar/site/test/talkback/%s'
% reply.getId()))
reply1 = talkback.getReplies()[0]
path1 = '/'.join(reply1.getPhysicalPath())
self.assertEqual( ctool.getMetadataForUID(path1),
{'in_reply_to': None} )
talkback1 = dtool.getDiscussionFor(reply1)
talkback1.createReply( title='test2'
, text='blah2'
)
for reply in talkback.getReplies():
self.failUnless(has_path(ctool, reply.getPhysicalPath()))
self.failUnless(has_path(ctool, '/bar/site/test/talkback/%s'
% reply.getId()))
for reply in talkback1.getReplies():
self.failUnless(has_path(ctool, reply.getPhysicalPath()))
self.failUnless(has_path(ctool, '/bar/site/test/talkback/%s'
% reply.getId()))
reply2 = talkback1.getReplies()[0]
path2 = '/'.join(reply2.getPhysicalPath())
self.assertEqual( ctool.getMetadataForUID(path2),
{'in_reply_to': reply1.getId()} )