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


Python IReferenceable.isImplementedBy方法代码示例

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


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

示例1: afterRetrieveModifier

# 需要导入模块: from Products.Archetypes.interfaces.referenceable import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.referenceable.IReferenceable import isImplementedBy [as 别名]
    def afterRetrieveModifier(self, obj, repo_clone, preserve=()):
        # check if the modifier is called with a valid working copy
        if obj is None:
            return [], [], {}

        if (
            (
                HAVE_Z3_IFACE
                and IReferenceable.providedBy(obj)
                or not HAVE_Z3_IFACE
                and IReferenceable.isImplementedBy(obj)
            )
            and hasattr(aq_base(obj), REFERENCE_ANNOTATION)
            and hasattr(aq_base(repo_clone), REFERENCE_ANNOTATION)
        ):
            # Remove AT references that no longer exists in the retrived version
            orig_refs_container = getattr(aq_base(obj), REFERENCE_ANNOTATION)
            repo_clone_refs_container = getattr(aq_base(repo_clone), REFERENCE_ANNOTATION)
            ref_objs = orig_refs_container.objectValues()
            repo_clone_ref_ids = repo_clone_refs_container.objectIds()

            reference_catalog = getToolByName(obj, "reference_catalog")
            if reference_catalog:
                for ref in ref_objs:
                    if ref.getId() not in repo_clone_ref_ids:
                        reference_catalog.deleteReference(ref.sourceUID, ref.targetUID, ref.relationship)

        return [], [], {}
开发者ID:pchanxxx,项目名称:msc-buidout,代码行数:30,代码来源:StandardModifiers.py

示例2: test_implements

# 需要导入模块: from Products.Archetypes.interfaces.referenceable import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.referenceable.IReferenceable import isImplementedBy [as 别名]
 def test_implements(self):
     if self.dummy is not None:
         self.failIf(IReferenceable.isImplementedBy(self.dummy))
         self.failIf(IExtensibleMetadata.isImplementedBy(self.dummy))
         self.failIf(self.dummy.isReferenceable)
         self.failUnless(IBaseContent.isImplementedBy(self.dummy))
         self.failUnless(IATTopicCriterion.isImplementedBy(self.dummy))
         self.failUnless(verifyObject(IBaseContent, self.dummy))
         self.failUnless(verifyObject(IATTopicCriterion, self.dummy))
开发者ID:dtgit,项目名称:dtedu,代码行数:11,代码来源:test_criteria.py

示例3: afterRetrieveModifier

# 需要导入模块: from Products.Archetypes.interfaces.referenceable import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.referenceable.IReferenceable import isImplementedBy [as 别名]
    def afterRetrieveModifier(self, obj, repo_clone, preserve=()):
        # check if the modifier is called with a valid working copy
        if obj is None:
            return [], [], {}

        if not WRONG_AT:
            if IReferenceable.isImplementedBy(obj) \
                and hasattr(aq_base(obj), REFERENCE_ANNOTATION):
                #Preserve AT references
                orig_refs_container = getattr(aq_base(obj), REFERENCE_ANNOTATION)
                setattr(repo_clone, REFERENCE_ANNOTATION, orig_refs_container)
        return [], [], {}
开发者ID:dtgit,项目名称:dtedu,代码行数:14,代码来源:StandardModifiers.py

示例4: _fixupATReferences

# 需要导入模块: from Products.Archetypes.interfaces.referenceable import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.referenceable.IReferenceable import isImplementedBy [as 别名]
    def _fixupATReferences(self, obj):
        """Reindex AT reference data, and delete reference
        implementations when the target
        doesn't exist anymore.

        Deletion of references is done at the end of the
        recursiveRetrieve operation to avoid deleting refs to targets
        that will be retrieved later in the recursiveRetrive. It
        doesn't call refcatalog.deleteReference as that method uses
        brains to retrieve reference implementations. If the
        target doesn't exist, brains for references pointing to it
        do not exist either.

        This manually calls reference.delHook to let it finalize
        correctly but traps ReferenceException eventually emitted in
        the process and forces the deletion, because leaving the
        reference impl. there will leave refcatalog in an
        incosistent state.
        """

        if (
            HAVE_Z3_IFACE and
            IReferenceable.providedBy(obj) or
            not HAVE_Z3_IFACE and
            IReferenceable.isImplementedBy(obj)
        ) and hasattr(obj, REFERENCES_CONTAINER_NAME):
            # Delete refs if their target doesn't exists anymore
            ref_folder = getattr(obj, REFERENCES_CONTAINER_NAME)
            uid_catalog = getToolByName(self, "uid_catalog")
            ref_catalog = getToolByName(self, "reference_catalog")
            ref_objs = ref_folder.objectValues()
            for ref in ref_objs:
                if not uid_catalog(UID=ref.targetUID):
                    try:
                        # at's _deleteReference passes the catalog
                        # itself, the source and target obj... i'm
                        # going to emulate it as much as i can
                        ref.delHook(ref_catalog, obj, None)
                    except ReferenceException:
                        pass
                    ref_folder.manage_delObjects(ref.getId())
            # then reindex references
            container = aq_parent(aq_inner(obj))
            obj._updateCatalog(container)
开发者ID:plone,项目名称:Products.CMFEditions,代码行数:46,代码来源:CopyModifyMergeRepositoryTool.py

示例5: _catalogReferencesFor

# 需要导入模块: from Products.Archetypes.interfaces.referenceable import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.referenceable.IReferenceable import isImplementedBy [as 别名]
 def _catalogReferencesFor(self,obj,path):
     if IReferenceable.isImplementedBy(obj):
         obj._catalogRefs(self)
开发者ID:dtgit,项目名称:dtedu,代码行数:5,代码来源:ReferenceEngine.py

示例6: isReferenceable

# 需要导入模块: from Products.Archetypes.interfaces.referenceable import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.referenceable.IReferenceable import isImplementedBy [as 别名]
 def isReferenceable(self, object):
     return (IReferenceable.isImplementedBy(object) or
             shasattr(object, 'isReferenceable'))
开发者ID:dtgit,项目名称:dtedu,代码行数:5,代码来源:ReferenceEngine.py

示例7: test_doesImplementAT

# 需要导入模块: from Products.Archetypes.interfaces.referenceable import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.referenceable.IReferenceable import isImplementedBy [as 别名]
 def test_doesImplementAT(self):
     self.failUnless(IBaseContent.isImplementedBy(self._ATCT))
     self.failUnless(IReferenceable.isImplementedBy(self._ATCT))
     self.failUnless(verifyObject(IBaseContent, self._ATCT))
     self.failUnless(verifyObject(IReferenceable, self._ATCT))
开发者ID:dtgit,项目名称:dtedu,代码行数:7,代码来源:atcttestcase.py


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