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


Python IReferenceable.objectValues方法代码示例

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


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

示例1: moved_handler

# 需要导入模块: from Products.Archetypes.interfaces import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.IReferenceable import objectValues [as 别名]
def moved_handler(obj, event):
    """Remove object from uid_catalog and add it back"""
    # Not sure if this is the proper way to handle it.
    # it is needed because of what happens in Products.ZCatalog.Catalog.py
    # line 317.
    # When path has changed, the object cannot be found, and we end up with
    # old and invalid uids.
    uid_catalog, ref_catalog = _get_catalogs(obj)
    uid = IUUID(obj.aq_base, None)

    if uid:
        results = uid_catalog(UID=uid)

        if len(results) > 0:
            old_obj = results[0]
            uid_catalog.uncatalog_object(old_obj.getPath())
            path = '/'.join(obj.getPhysicalPath())
            uid_catalog.catalog_object(obj, path)

    #  AT API
    annotations = IATReferenceable(obj)._getReferenceAnnotations()
    if not annotations:
        return

    for ref in annotations.objectValues():
        url = getRelURL(ref_catalog, ref.getPhysicalPath())
        if event.oldName and event.newName:
            url = event.oldName + url[len(event.newName):]
        uid_catalog_rid = uid_catalog.getrid(url)
        ref_catalog_rid = ref_catalog.getrid(url)
        if uid_catalog_rid is not None:
            uid_catalog.uncatalog_object(url)
        if ref_catalog_rid is not None:
            ref_catalog.uncatalog_object(url)
开发者ID:plone,项目名称:plone.app.referenceablebehavior,代码行数:36,代码来源:uidcatalog.py

示例2: modified_handler

# 需要导入模块: from Products.Archetypes.interfaces import IReferenceable [as 别名]
# 或者: from Products.Archetypes.interfaces.IReferenceable import objectValues [as 别名]
def modified_handler(obj, event):
    """Reindex object in uid_catalog"""
    uid_catalog, ref_catalog = _get_catalogs(obj)
    path = '/'.join(obj.getPhysicalPath())
    uid_catalog.catalog_object(obj, path)

    #  AT API
    annotations = IATReferenceable(obj)._getReferenceAnnotations()
    if not annotations:
        return

    for ref in annotations.objectValues():
        url = getRelURL(ref_catalog, ref.getPhysicalPath())
        uid_catalog.catalog_object(ref, url)
        ref_catalog.catalog_object(ref, url)
        ref._catalogRefs(uid_catalog, uid_catalog, ref_catalog)
开发者ID:plone,项目名称:plone.app.referenceablebehavior,代码行数:18,代码来源:uidcatalog.py


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