本文整理汇总了Python中plone.folder.interfaces.IExplicitOrdering.orderObjects方法的典型用法代码示例。如果您正苦于以下问题:Python IExplicitOrdering.orderObjects方法的具体用法?Python IExplicitOrdering.orderObjects怎么用?Python IExplicitOrdering.orderObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plone.folder.interfaces.IExplicitOrdering
的用法示例。
在下文中一共展示了IExplicitOrdering.orderObjects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testReorderThenCopyTemplateKeepsOrder
# 需要导入模块: from plone.folder.interfaces import IExplicitOrdering [as 别名]
# 或者: from plone.folder.interfaces.IExplicitOrdering import orderObjects [as 别名]
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)