本文整理汇总了Python中plone.app.iterate.interfaces.ICheckinCheckoutPolicy.invokeFactory方法的典型用法代码示例。如果您正苦于以下问题:Python ICheckinCheckoutPolicy.invokeFactory方法的具体用法?Python ICheckinCheckoutPolicy.invokeFactory怎么用?Python ICheckinCheckoutPolicy.invokeFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plone.app.iterate.interfaces.ICheckinCheckoutPolicy
的用法示例。
在下文中一共展示了ICheckinCheckoutPolicy.invokeFactory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_folderContents
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import invokeFactory [as 别名]
def test_folderContents(self):
"""When an folder is checked out, and item is added, and then
the folder is checked back in, the added item is in the new
version of the folder. UIDs of contained content are also
preserved."""
container = self.portal.docs
folder = container[container.invokeFactory(
type_name='Folder', id='foo-folder')]
existing_doc = folder[folder.invokeFactory(
type_name='Document', id='existing-folder-item')]
existing_doc_uid = existing_doc.UID()
self.repo.save(folder)
wc = ICheckinCheckoutPolicy(folder).checkout(container)
new_doc = wc[wc.invokeFactory(type_name='Document',
id='new-folder-item',
text='new folder item text')]
new_doc_uid = new_doc.UID()
new_folder = ICheckinCheckoutPolicy(wc).checkin("updated")
catalog = getToolByName(self.portal, 'portal_catalog')
self.assertTrue('existing-folder-item' in new_folder)
self.assertEqual(
new_folder['existing-folder-item'].UID(), existing_doc_uid)
self.assertTrue('new-folder-item' in new_folder)
self.assertEqual(new_folder['new-folder-item'].UID(), new_doc_uid)
brains = catalog(path='/'.join(
new_folder['new-folder-item'].getPhysicalPath()))
self.assertTrue(brains)
self.assertTrue('new folder item text' in
new_folder['new-folder-item'].getText())
示例2: test_add_name_to_wc
# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import invokeFactory [as 别名]
def test_add_name_to_wc(self):
self.setRoles(('Contributor',))
p1 = self.places['1']
self.failUnless('foo' in p1, p1.keys())
wc = ICheckinCheckoutPolicy(p1).checkout(self.places)
nid = wc.invokeFactory('Name', 'bar', nameTransliterated=u"Bar")
self.failUnless('bar' in wc, wc.keys())
p1 = ICheckinCheckoutPolicy(wc).checkin("updated")
self.failUnless('foo' in p1, p1.keys())
self.failUnless('bar' in p1, p1.keys())
# A child's history acquires its parent's history
history = self.repo.getHistory(p1['foo'])
self.failUnlessEqual(len(history), 2)
history = self.repo.getHistory(p1['bar'])
self.failUnlessEqual(len(history), 1)