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


Python Plone._initializeData方法代码示例

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


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

示例1: testDisablePortlets

# 需要导入模块: from Products.CMFPlone.browser.ploneview import Plone [as 别名]
# 或者: from Products.CMFPlone.browser.ploneview.Plone import _initializeData [as 别名]
 def testDisablePortlets(self):
     view = Plone(self.portal, self.app.REQUEST)
     view._initializeData()
     data = view._data
     self.assertEqual(True, data['sr'])
     self.assertEqual('visualColumnHideOne', data['hidecolumns'])
     view._initializeData(options={'no_portlets': True})
     self.assertEqual(False, data['sr'])
     self.assertEqual('visualColumnHideOneTwo', data['hidecolumns'])
开发者ID:dtgit,项目名称:dtedu,代码行数:11,代码来源:testPloneView.py

示例2: testActionOverrideFromTemplate

# 需要导入模块: from Products.CMFPlone.browser.ploneview import Plone [as 别名]
# 或者: from Products.CMFPlone.browser.ploneview.Plone import _initializeData [as 别名]
 def testActionOverrideFromTemplate(self):
     # We should be able to pass actions in from the template
     # and have them override the calculated actions
     view = Plone(self.portal, self.app.REQUEST)
     view._initializeData()
     data = view._data
     self.failUnless(data['actions'])
     self.failUnless(data['keyed_actions'])
     self.failUnless(data['user_actions'])
     no_actions = {'folder':[], 'user':[], 'global':[], 'workflow':[]}
     view._initializeData(options={'actions':no_actions})
     self.assertEqual(data['actions'], no_actions)
     self.assertEqual(data['keyed_actions'], no_actions)
     self.failIf(data['user_actions'])
开发者ID:dtgit,项目名称:dtedu,代码行数:16,代码来源:testPloneView.py

示例3: TestPloneView

# 需要导入模块: from Products.CMFPlone.browser.ploneview import Plone [as 别名]
# 或者: from Products.CMFPlone.browser.ploneview.Plone import _initializeData [as 别名]
class TestPloneView(PloneTestCase.PloneTestCase):
    """Tests the global plone view.  All the old global_defines should be
       in the _data mapping of the view, which is globablized into
       calling templates."""

    def afterSetUp(self):
        # We need to fiddle the request for zope 2.9+
        setDefaultSkin(self.app.REQUEST)
        self.folder.invokeFactory('Document', 'test',
                                  title='Test default page')
        self.view = Plone(self.portal, self.app.REQUEST)
        self.view._initializeData()

    def testUTool(self):
        assert isinstance(self.view._data['utool'], URLTool)

    def testPortal(self):
        assert self.view._data['portal'] == self.portal

    def testPortalURL(self):
        assert isinstance(self.view._data['portal_url'], type(''))

    def testMTool(self):
        assert isinstance(self.view._data['mtool'], MembershipTool)

    def testATool(self):
        assert isinstance(self.view._data['atool'], ActionsTool)

    def testPUtils(self):
        pass

    def testWTool(self):
        assert isinstance(self.view._data['wtool'], WorkflowTool)

    def testIFaceTool(self):
        assert isinstance(self.view._data['ifacetool'], InterfaceTool)

    def testSynTool(self):
        assert isinstance(self.view._data['syntool'], SyndicationTool)

    def testPortalTitle(self):
        pass

    def testToLocalizedTime(self):
        localdate = self.view.toLocalizedTime
        value = localdate('Mar 9, 1997 1:45pm', long_format=True)
        self.assertEquals(value, 'Mar 09, 1997 01:45 PM')

    def testIsStructuralFolderWithNonFolder(self):
        i = dummy.Item()
        self.failIf(Plone(i, self.app.REQUEST).isStructuralFolder())

    def testIsStructuralFolderWithFolder(self):
        f = dummy.Folder('struct_folder')
        self.failUnless(Plone(f, self.app.REQUEST).isStructuralFolder())

    def testIsStructuralFolderWithNonStructuralFolder(self):
        f = dummy.NonStructuralFolder('ns_folder')
        self.failIf(Plone(f, self.app.REQUEST).isStructuralFolder())

    def testIsStructuralFolderWithZ2NonStructuralFolder(self):
        f = dummy.Folder('z2_nsFolder')
        f.__implements__ = f.__implements__ + (z2INonStructuralFolder,)
        view = Plone(f, self.app.REQUEST)
        value = view.isStructuralFolder()
        self.failIf(Plone(f, self.app.REQUEST).isStructuralFolder())

    def testIsDefaultPageInFolder(self):
        view = Plone(self.folder.test, self.app.REQUEST)
        self.failIf(view.isDefaultPageInFolder())
        self.failUnless(self.folder.canSelectDefaultPage())
        self.folder.saveDefaultPage('test')
        # re-create the view, because the old value is cached
        del self.app.REQUEST.__annotations__
        view = Plone(self.folder.test, self.app.REQUEST)
        self.failUnless(view.isDefaultPageInFolder())

    def testNavigationRootPath(self):
        view = Plone(self.folder, self.app.REQUEST)
        self.assertEqual(view.navigationRootPath(), self.portal.portal_url.getPortalPath())

    def testNavigationRootUrl(self):
        view = Plone(self.folder, self.app.REQUEST)
        self.assertEqual(view.navigationRootUrl(), self.portal.absolute_url())

    def testGetParentObject(self):
        view = Plone(self.folder.test, self.app.REQUEST)
        self.assertEqual(view.getParentObject(), self.folder)
        # Make sure this looks only at containment
        del self.app.REQUEST.__annotations__
        view = Plone(self.folder.test.__of__(self.portal), self.app.REQUEST)
        self.assertEqual(view.getParentObject(), self.folder)

    def testIsFolderOrFolderDefaultPage(self):
        # an actual folder whould return true
        view = Plone(self.folder, self.app.REQUEST)
        self.failUnless(view.isFolderOrFolderDefaultPage())
        # But not a document
        del self.app.REQUEST.__annotations__
        view = Plone(self.folder.test, self.app.REQUEST)
#.........这里部分代码省略.........
开发者ID:dtgit,项目名称:dtedu,代码行数:103,代码来源:testPloneView.py


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