本文整理汇总了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)
示例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)