• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python interfaces.IOrderedContainer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中OFS.interfaces.IOrderedContainer的典型用法代码示例。如果您正苦于以下问题:Python IOrderedContainer类的具体用法?Python IOrderedContainer怎么用?Python IOrderedContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: _get_position_in_parent

 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
开发者ID:oikoumene,项目名称:startupworks.pjp,代码行数:7,代码来源:utils.py


示例2: revertOrder

def revertOrder(obj, eve):
    """
    Use IOrderedContainer interface to move an object to top of folder on creation.
    """
    parent = obj.aq_inner.aq_parent
    ordered = IOrderedContainer(parent, None)
    if ordered is not None:
        ordered.moveObjectToPosition(obj.getId(), 0)
开发者ID:ida,项目名称:adi.revertorder,代码行数:8,代码来源:subscriber.py


示例3: getObjPositionInParent

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
开发者ID:erral,项目名称:Products.CMFPlone,代码行数:8,代码来源:CatalogTool.py


示例4: _getPositionInParent

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
开发者ID:zopyx,项目名称:zopyx.plone.migration,代码行数:9,代码来源:exporter.py


示例5: getObjPositionInParent

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
开发者ID:nacho22martin,项目名称:tesis,代码行数:13,代码来源:CatalogTool.py


示例6: __init__

 def __init__(self, context):
     self.context = context
     self.mship = getToolByName(self.context, 'portal_membership')
     self.sort = IOrderedContainer.providedBy(self.context) and self.mship.checkPermission(permissions.ModifyPortalContent, self.context)
     self.sort_url = '%s/article_moveitem?anchor=%%s&delta=%%s&item_id=%%s' % self.context.absolute_url()
     self.show_hide_url = '%s/@@article_showhideitem?anchor=%%s&action=%%s&uid=%%s&component=%%s' % self.context.absolute_url()
     self.delete = self.mship.checkPermission(permissions.DeleteObjects, self.context)
开发者ID:vito80ba,项目名称:raptus.article.core,代码行数:7,代码来源:manageable.py


示例7: __init__

 def __init__(self, context):
     self.pos = []
     self.component = ''
     self.context = context
     self.mship = getToolByName(self.context, 'portal_membership')
     self.delete = self.mship.checkPermission(permissions.DeleteObjects, self.context) or False
     self.sort = (IOrderedContainer.providedBy(self.context)
                 and self.mship.checkPermission(permissions.ModifyPortalContent, self.context)) or False
开发者ID:hexagonit,项目名称:raptus.article.core,代码行数:8,代码来源:manageable.py


示例8: __call__

    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
开发者ID:4teamwork,项目名称:ftw.jsondump,代码行数:19,代码来源:metadata.py


示例9: _extractObjects

 def _extractObjects(self):
     fragment = self._doc.createDocumentFragment()
     objects = self.context.objectValues()
     if not IOrderedContainer.providedBy(self.context):
         objects = list(objects)
         objects.sort(lambda x,y: cmp(x.getId(), y.getId()))
     for obj in objects:
         exporter = queryMultiAdapter((obj, self.environ), INode)
         if exporter:
             fragment.appendChild(exporter.node)
     return fragment
开发者ID:goschtl,项目名称:zope,代码行数:11,代码来源:utils.py


示例10: getOrdering

 def getOrdering(self):
     if IPloneSiteRoot.providedBy(self.context):
         return self.context
     try:
         ordering = self.context.aq_base.getOrdering()
     except AttributeError:
         if IOrderedContainer.providedBy(self.context):
             # Archetype
             return IOrderedContainer(self.context)
         return None
     if not IExplicitOrdering.providedBy(ordering):
         return None
     return ordering
开发者ID:pretaweb,项目名称:plone.app.content,代码行数:13,代码来源:rearrange.py


示例11: orderable

    def orderable(self):
        """
        """
        if self.is_special_type():
            return True

        iface = IOrderedContainer.providedBy(aq_inner(self.context))

        attr = self.context.aq_explicit\
            .get('sortAttribute', '') == 'getObjPositionInParent'
        if self.contentFilter.get('sort_on', '') != 'getObjPositionInParent':
            return False
        return iface and attr
开发者ID:4teamwork,项目名称:izug.basetheme,代码行数:13,代码来源:foldercontents.py


示例12: _copyPortalAttributes

    def _copyPortalAttributes(self, peer):
        peer.portal_type = self.context.portal_type
        peer.content_uid = self.context.UID()
        peer.id = self.context.id

        peer.path = '/'.join(self.context.getPhysicalPath())
        portal_url = getattr(self.context, 'portal_url', None)
        if portal_url:
            peer.relative_path = "/".join(
                portal_url.getRelativeContentPath(self.context))
        wf_tool = getattr(self.context, 'portal_workflow', None)
        if wf_tool is None:
            return
        peer.status = wf_tool.getCatalogVariablesFor(
            self.context).get('review_state')

        container = self.context.getParentNode()
        if not IOrderedContainer.providedBy(container):
            return

        peer.folder_position = container.getObjectPosition(
            self.context.getId())
开发者ID:jasonheffner,项目名称:contentmirror,代码行数:22,代码来源:serializer.py


示例13: test_implementsOrderInterface

 def test_implementsOrderInterface(self):
     self.failUnless(OFSIOrderedContainer.providedBy(self._ATCT))
     self.failUnless(IZopeOrderedContainer.isImplementedBy(self._ATCT))
     self.failUnless(IOrderedContainer.isImplementedBy(self._ATCT))
     self.failUnless(verifyObject(IZopeOrderedContainer, self._ATCT))
     self.failUnless(verifyObject(IOrderedContainer, self._ATCT))
开发者ID:dtgit,项目名称:dtedu,代码行数:6,代码来源:test_atfolder.py


示例14: test_ordered_container_interface

 def test_ordered_container_interface(self):
     """Verify the OrderedContainer interface being used."""
     self.assertTrue(IOrderedContainer.providedBy(self.folder))
开发者ID:jasonheffner,项目名称:contentmirror,代码行数:3,代码来源:test_position.py


示例15: get_position_in_parent

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
开发者ID:affinitic,项目名称:fbk.policy,代码行数:6,代码来源:itemlisting.py


示例16: test_implementsOrderInterface

 def test_implementsOrderInterface(self):
     self.assertTrue(IOrderedContainer.providedBy(self._ATCT))
     self.assertTrue(verifyObject(IOrderedContainer, self._ATCT))
开发者ID:plone,项目名称:Products.ATContentTypes,代码行数:3,代码来源:test_atfolder.py


示例17: test_isOrdered

 def test_isOrdered(self):
     self.assertTrue(IOrderedContainer.providedBy(self._ATCT))
开发者ID:plone,项目名称:Products.ATContentTypes,代码行数:2,代码来源:test_atfolder.py


示例18: orderable

 def orderable(self):
     """
     """
     return IOrderedContainer.providedBy(aq_inner(self.context))
开发者ID:erichardy,项目名称:iuem.photorepository,代码行数:4,代码来源:repoFolderContents.py


示例19: test_isOrdered

 def test_isOrdered(self):
     self.failUnless(IOrderedContainer.providedBy(self._ATCT))
开发者ID:nacho22martin,项目名称:tesis,代码行数:2,代码来源:test_atfolder.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python OMBManagerLocale._函数代码示例发布时间:2022-05-24
下一篇:
Python interfaces.IObjectWillBeMovedEvent类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap