當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。