当前位置: 首页>>代码示例>>Python>>正文


Python ICheckinCheckoutPolicy.invokeFactory方法代码示例

本文整理汇总了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())
开发者ID:iham,项目名称:plone.app.iterate,代码行数:34,代码来源:test_iterate.py

示例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)
开发者ID:isawnyu,项目名称:pleiades-iterate,代码行数:17,代码来源:test_iterate.py


注:本文中的plone.app.iterate.interfaces.ICheckinCheckoutPolicy.invokeFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。