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


Python interfaces.IExplicitOrdering类代码示例

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


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

示例1: render

    def render(self):
        order=self.request.form.get("order[]")
        if not order or not isinstance(order, list):
            return

        orderer=IExplicitOrdering(aq_inner(self.context))
        for (pos, id) in enumerate(order):
            id=id.split("-", 1)[1]
            orderer.moveObjectToPosition(id, pos)

        return
开发者ID:,项目名称:,代码行数:11,代码来源:

示例2: orderObjects

 def orderObjects(self, key, reverse=None):
     """ Order sub-objects by key and direction. """
     ordering = self.getOrdering()
     if IExplicitOrdering.providedBy(ordering):
         return ordering.orderObjects(key, reverse)
     else:
         return 0
开发者ID:,项目名称:,代码行数:7,代码来源:

示例3: moveObjectToPosition

 def moveObjectToPosition(self, id, position, suppress_events=False):
     """ Move specified object to absolute position. """
     ordering = self.getOrdering()
     if IExplicitOrdering.providedBy(ordering):
         return ordering.moveObjectToPosition(id, position, suppress_events)
     else:
         return 0
开发者ID:,项目名称:,代码行数:7,代码来源:

示例4: moveObjectsToBottom

 def moveObjectsToBottom(self, ids, subset_ids=None):
     """ Move specified sub-objects to bottom of container. """
     ordering = self.getOrdering()
     if IExplicitOrdering.providedBy(ordering):
         return ordering.moveObjectsToBottom(ids, subset_ids)
     else:
         return 0
开发者ID:,项目名称:,代码行数:7,代码来源:

示例5: moveObjectsDown

 def moveObjectsDown(self, ids, delta=1, subset_ids=None):
     """ Move specified sub-objects down by delta in container. """
     ordering = self.getOrdering()
     if IExplicitOrdering.providedBy(ordering):
         return ordering.moveObjectsDown(ids, delta, subset_ids)
     else:
         return 0
开发者ID:,项目名称:,代码行数:7,代码来源:

示例6: orderable

 def orderable(self):
     if _is_collection(self.context):
         return False
     if IPloneSiteRoot.providedBy(self.context):
         return True
     ordering = self.context.getOrdering()
     return IExplicitOrdering.providedBy(ordering)
开发者ID:jcerjak,项目名称:wildcard.foldercontents,代码行数:7,代码来源:views.py

示例7: _supports_explicit_ordering

def _supports_explicit_ordering(context):
    if IPloneSiteRoot.providedBy(context):
        return True
    if not IOrderableFolder.providedBy(context):
        return False
    ordering = context.getOrdering()
    return IExplicitOrdering.providedBy(ordering)
开发者ID:tud-mit-plone,项目名称:wildcard.foldercontents,代码行数:7,代码来源:views.py

示例8: __call__

    def __call__(self, item_id, delta, subset_ids=None):
        context = aq_inner(self.context)
        try:
            if not IOrderableFolder.providedBy(context):
                if not base_hasattr(context, 'moveObjectsByDelta'):
                    # for instance, plone site root does not use plone.folder
                    raise ValueError("Not an ordered folder.")
            else:
                ordering = context.getOrdering()
                if not IExplicitOrdering.providedBy(ordering):
                    raise ValueError("Ordering disable on folder.")

            delta = int(delta)
            if subset_ids is not None:
                objectPos = self.context.getObjectPosition
                position_id = [(objectPos(id), id) for id in subset_ids]
                position_id.sort()
                if subset_ids != [id for position, id in position_id]:
                    raise ValueError("Client/server ordering mismatch.")
                self.context.moveObjectsByDelta(item_id, delta, subset_ids)
        except ValueError as e:
            self.context.REQUEST.response.setStatus('BadRequest')
            return str(e)

        ploneUtils = getToolByName(self.context, 'plone_utils')
        ploneUtils.reindexOnReorder(self.context)
        return "<done />"
开发者ID:Doap,项目名称:plone.app.cmsui,代码行数:27,代码来源:structure.py

示例9: getOrdering

 def getOrdering(self):
     if IPloneSiteRoot.providedBy(self.context):
         return self.context
     ordering = self.context.getOrdering()
     if not IExplicitOrdering.providedBy(ordering):
         return None
     return ordering
开发者ID:hatchddigital,项目名称:plone.app.content,代码行数:7,代码来源:rearrange.py

示例10: getOrdering

def getOrdering(context):
    if IPloneSiteRoot.providedBy(context):
        return context
    else:
        ordering = context.getOrdering()
        if not IExplicitOrdering.providedBy(ordering):
            return None
        return ordering
开发者ID:enfold,项目名称:wildcard.foldercontents,代码行数:8,代码来源:views.py

示例11: moveObjectsByDelta

 def moveObjectsByDelta(self, ids, delta, subset_ids=None,
         suppress_events=False):
     """ Move specified sub-objects by delta. """
     ordering = self.getOrdering()
     if IExplicitOrdering.providedBy(ordering):
         return ordering.moveObjectsByDelta(ids, delta, subset_ids,
             suppress_events)
     else:
         return 0
开发者ID:,项目名称:,代码行数:9,代码来源:

示例12: orderable

 def orderable(self):
     """
     """
     context = aq_inner(self.context)
     if not IOrderableFolder.providedBy(context):
         if hasattr(context, 'moveObjectsByDelta'):
             # for instance, plone site root does not use plone.folder
             return True
         else:
             return False
     ordering = context.getOrdering()
     return IExplicitOrdering.providedBy(ordering)
开发者ID:Doap,项目名称:plone.app.cmsui,代码行数:12,代码来源:structure.py

示例13: 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

示例14: testReorderThenCopyTemplateKeepsOrder

 def testReorderThenCopyTemplateKeepsOrder(self):
     from Acquisition import aq_parent
     from plone.folder.interfaces import IExplicitOrdering
     from euphorie.content.surveygroup import AddForm
     original_order = [u"one", u"two", u"three", u"four", u"five", u"six",
                       u"seven", u"eight", u"nine", u"ten"]
     sorted_order = list(sorted(original_order))
     self.loginAsPortalOwner()
     module = self.createModule()
     for title in original_order:
         self._create(module, "euphorie.risk", title, title=title)
     self.assertEqual([r.title for r in module.values()], original_order)
     ordering = IExplicitOrdering(module)
     ordering.orderObjects("title")
     self.assertEqual([r.title for r in module.values()], sorted_order)
     request = module.REQUEST
     survey = aq_parent(module)
     container = self.portal.sectors.nl.sector
     target = self._create(container, "euphorie.surveygroup", "target")
     copy = AddForm(container, request).copyTemplate(survey, target)
     self.assertEqual(
             [r.title for r in copy["module"].values()], sorted_order)
开发者ID:,项目名称:,代码行数:22,代码来源:


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