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


Python Plone.getCurrentFolder方法代码示例

本文整理汇总了Python中Products.CMFPlone.browser.ploneview.Plone.getCurrentFolder方法的典型用法代码示例。如果您正苦于以下问题:Python Plone.getCurrentFolder方法的具体用法?Python Plone.getCurrentFolder怎么用?Python Plone.getCurrentFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Products.CMFPlone.browser.ploneview.Plone的用法示例。


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

示例1: testGetCurrentFolder

# 需要导入模块: from Products.CMFPlone.browser.ploneview import Plone [as 别名]
# 或者: from Products.CMFPlone.browser.ploneview.Plone import getCurrentFolder [as 别名]
    def testGetCurrentFolder(self):
        # If context is a folder, then the folder is returned
        view = Plone(self.folder, self.app.REQUEST)
        self.assertEqual(view.getCurrentFolder(), self.folder)

        # If context is not a folder, then the parent is returned
        # A bit crude ... we need to make sure our memos don't stick in the
        # tests
        self._invalidateRequestMemoizations()
        view = Plone(self.folder.test, self.app.REQUEST)
        self.assertEqual(view.getCurrentFolder(), self.folder)

        # The real container is returned regardless of context
        self._invalidateRequestMemoizations()
        view = Plone(self.folder.test.__of__(self.portal), self.app.REQUEST)
        self.assertEqual(view.getCurrentFolder(), self.folder)

        # A non-structural folder does not count as a folder`
        f = dummy.NonStructuralFolder('ns_folder')
        self.folder._setObject('ns_folder', f)
        self._invalidateRequestMemoizations()
        view = Plone(self.folder.ns_folder, self.app.REQUEST)
        self.assertEqual(view.getCurrentFolder(), self.folder)

        # And even a structural folder that is used as a default page
        # returns its parent
        self.folder.setDefaultPage('ns_folder')
        self._invalidateRequestMemoizations()
        view = Plone(self.folder.ns_folder, self.app.REQUEST)
        self.assertEqual(view.getCurrentFolder(), self.folder)
开发者ID:JensenJiang,项目名称:Products.CMFPlone,代码行数:32,代码来源:testPloneView.py

示例2: testGetCurrentFolder

# 需要导入模块: from Products.CMFPlone.browser.ploneview import Plone [as 别名]
# 或者: from Products.CMFPlone.browser.ploneview.Plone import getCurrentFolder [as 别名]
 def testGetCurrentFolder(self):
     # If context is a folder, then the folder is returned
     view = Plone(self.folder, self.app.REQUEST)
     self.assertEqual(view.getCurrentFolder(), self.folder)
     
     # If context is not a folder, then the parent is returned
     # A bit crude ... we need to make sure our memos don't stick in the tests
     del self.app.REQUEST.__annotations__
     view = Plone(self.folder.test, self.app.REQUEST)
     self.assertEqual(view.getCurrentFolder(), self.folder)
     
     # The real container is returned regardless of context
     del self.app.REQUEST.__annotations__
     view = Plone(self.folder.test.__of__(self.portal), self.app.REQUEST)
     self.assertEqual(view.getCurrentFolder(), self.folder)
     
     # A non-structural folder does not count as a folder`
     f = dummy.NonStructuralFolder('ns_folder')
     self.folder._setObject('ns_folder', f)
     del self.app.REQUEST.__annotations__
     view = Plone(self.folder.ns_folder, self.app.REQUEST)
     self.assertEqual(view.getCurrentFolder(), self.folder)
     
     # And even a structural folder that is used as a default page
     # returns its parent
     self.setRoles(['Manager'])
     self.folder.invokeFactory('Topic', 'topic')
     
     del self.app.REQUEST.__annotations__
     view = Plone(self.folder.topic, self.app.REQUEST)
     self.assertEqual(view.getCurrentFolder(), self.folder.topic)
     self.folder.saveDefaultPage('topic')
     
     del self.app.REQUEST.__annotations__
     view = Plone(self.folder.topic, self.app.REQUEST)
     self.assertEqual(view.getCurrentFolder(), self.folder)
开发者ID:dtgit,项目名称:dtedu,代码行数:38,代码来源:testPloneView.py


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