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


Python ICheckinCheckoutPolicy.getReferences方法代码示例

本文整理汇总了Python中plone.app.iterate.interfaces.ICheckinCheckoutPolicy.getReferences方法的典型用法代码示例。如果您正苦于以下问题:Python ICheckinCheckoutPolicy.getReferences方法的具体用法?Python ICheckinCheckoutPolicy.getReferences怎么用?Python ICheckinCheckoutPolicy.getReferences使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在plone.app.iterate.interfaces.ICheckinCheckoutPolicy的用法示例。


在下文中一共展示了ICheckinCheckoutPolicy.getReferences方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_baselineNoCopyReferences

# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import getReferences [as 别名]
    def test_baselineNoCopyReferences(self):
        # ensure that custom state is maintained with the no copy adapter

        # setup the named ref adapter
        from zope import component
        from Products.Archetypes.interfaces import IBaseObject
        from plone.app.iterate import relation, interfaces
        from plone.app.iterate.tests.utils import CustomReference

        component.provideAdapter(
            adapts=(IBaseObject,),
            provides=interfaces.ICheckinCheckoutReference,
            factory=relation.NoCopyReferenceAdapter,
            name="zebra")

        doc = self.portal.docs.doc1
        ref = doc.addReference(
            self.portal.docs, "zebra", referenceClass=CustomReference)
        ref.custom_state = "hello world"

        wc = ICheckinCheckoutPolicy(doc).checkout(self.portal.workarea)

        self.assertEqual(len(wc.getReferences("zebra")), 0)

        doc = ICheckinCheckoutPolicy(wc).checkin("updated")

        self.assertEqual(len(doc.getReferences("zebra")), 1)

        ref = doc.getReferenceImpl("zebra")[0]

        self.assert_(hasattr(ref, "custom_state"))
        self.assertEqual(ref.custom_state, "hello world")
开发者ID:iham,项目名称:plone.app.iterate,代码行数:34,代码来源:test_iterate.py

示例2: test_wcNewForwardReferencesCopied

# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import getReferences [as 别名]
 def test_wcNewForwardReferencesCopied( self ):
     # ensure that new wc references are copied back to the baseline on checkin
     doc = self.portal.docs.doc1
     doc.addReference( self.portal.docs )
     self.assertEqual( len(doc.getReferences("zebra")), 0)
     wc = ICheckinCheckoutPolicy( doc ).checkout( self.portal.workarea )
     wc.addReference( self.portal.docs.doc2, "zebra")
     doc = ICheckinCheckoutPolicy( wc ).checkin( "updated" )
     self.assertEqual( len(doc.getReferences("zebra")), 1 )
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:11,代码来源:test_iterate.py

示例3: test_baselineReferencesMaintained

# 需要导入模块: from plone.app.iterate.interfaces import ICheckinCheckoutPolicy [as 别名]
# 或者: from plone.app.iterate.interfaces.ICheckinCheckoutPolicy import getReferences [as 别名]
    def test_baselineReferencesMaintained(self):
        # ensure that baseline references are maintained when the object is
        # checked in copies forward, bkw are not copied, but are maintained.

        doc = self.portal.docs.doc1
        doc.addReference(self.portal.docs, "elephant")
        self.portal.docs.doc2.addReference(doc)

        wc = ICheckinCheckoutPolicy(doc).checkout(self.portal.workarea)

        doc = ICheckinCheckoutPolicy(wc).checkin("updated")

        # TODO: This fails in Plone 4.1. The new optimized catalog lookups
        # in the reference catalog no longer filter out non-existing reference
        # objects. In both Plone 4.0 and 4.1 there's two references, one of
        # them is a stale catalog entry in the reference catalog. The real fix
        # is to figure out how the stale catalog entry gets in there
        self.assertEqual(len(doc.getReferences()), 1)
        self.assertEqual(len(doc.getBackReferences()), 1)
开发者ID:iham,项目名称:plone.app.iterate,代码行数:21,代码来源:test_iterate.py


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