本文整理汇总了Python中OFS.interfaces.IOrderedContainer.getObjectPosition方法的典型用法代码示例。如果您正苦于以下问题:Python IOrderedContainer.getObjectPosition方法的具体用法?Python IOrderedContainer.getObjectPosition怎么用?Python IOrderedContainer.getObjectPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OFS.interfaces.IOrderedContainer
的用法示例。
在下文中一共展示了IOrderedContainer.getObjectPosition方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_position_in_parent
# 需要导入模块: from OFS.interfaces import IOrderedContainer [as 别名]
# 或者: from OFS.interfaces.IOrderedContainer import getObjectPosition [as 别名]
def _get_position_in_parent(obj):
# Use IOrderedContainer interface to extract the object's manual ordering position
parent = obj.aq_inner.aq_parent
ordered = IOrderedContainer(parent, None)
if ordered is not None:
return ordered.getObjectPosition(obj.getId())
return 0
示例2: getObjPositionInParent
# 需要导入模块: from OFS.interfaces import IOrderedContainer [as 别名]
# 或者: from OFS.interfaces.IOrderedContainer import getObjectPosition [as 别名]
def getObjPositionInParent(obj):
""" Helper method for catalog based folder contents.
"""
parent = aq_parent(aq_inner(obj))
ordered = IOrderedContainer(parent, None)
if ordered is not None:
return ordered.getObjectPosition(obj.getId())
return 0
示例3: _getPositionInParent
# 需要导入模块: from OFS.interfaces import IOrderedContainer [as 别名]
# 或者: from OFS.interfaces.IOrderedContainer import getObjectPosition [as 别名]
def _getPositionInParent(obj):
parent = aq_parent(aq_inner(obj))
ordered = IOrderedContainer(parent, None)
if ordered is not None:
pos = ordered.getObjectPosition(obj.getId())
else:
pos = 0
return pos
示例4: getObjPositionInParent
# 需要导入模块: from OFS.interfaces import IOrderedContainer [as 别名]
# 或者: from OFS.interfaces.IOrderedContainer import getObjectPosition [as 别名]
def getObjPositionInParent(obj):
""" Helper method for catalog based folder contents.
>>> from Products.CMFPlone.CatalogTool import getObjPositionInParent
>>> getObjPositionInParent(self.folder)
0
"""
parent = aq_parent(aq_inner(obj))
ordered = IOrderedContainer(parent, None)
if ordered is not None:
return ordered.getObjectPosition(obj.getId())
return 0
示例5: __call__
# 需要导入模块: from OFS.interfaces import IOrderedContainer [as 别名]
# 或者: from OFS.interfaces.IOrderedContainer import getObjectPosition [as 别名]
def __call__(self, config):
parent = aq_parent(aq_inner(self.context))
klass = self.context.__class__
owner = self.context.getOwner()
data = {'_classname': klass.__name__,
'_class': klass.__module__ + '.' + klass.__name__,
'_id': self.context.getId(),
'_owner': owner and owner.getId(),
'_path': '/'.join(self.context.getPhysicalPath()),
'_type': self.context.portal_type}
ordered_parent = IOrderedContainer(parent, None)
if ordered_parent:
data['_obj_position_in_parent'] = ordered_parent.getObjectPosition(
self.context.getId())
return data
示例6: get_position_in_parent
# 需要导入模块: from OFS.interfaces import IOrderedContainer [as 别名]
# 或者: from OFS.interfaces.IOrderedContainer import getObjectPosition [as 别名]
def get_position_in_parent(obj):
parent = obj.aq_inner.aq_parent
ordered = IOrderedContainer(parent, None)
if ordered is not None:
return ordered.getObjectPosition(obj.getId())
return 0