本文整理匯總了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()} )