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


Python ploneview.Plone类代码示例

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


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

示例1: TestVisibleIdsEnabled

class TestVisibleIdsEnabled(PloneTestCase.PloneTestCase):
    '''Tests the visibleIdsEnabled method'''

    def afterSetUp(self):
        self.view = Plone(self.portal, self.app.REQUEST)
        self.member = self.portal.portal_membership.getAuthenticatedMember()
        self.props = self.portal.portal_properties.site_properties

    def testFailsWithSitePropertyDisabled(self):
        # Set baseline
        self.member.setProperties(visible_ids=False)
        self.props.manage_changeProperties(visible_ids=False)
        # Should fail when site property is set false
        self.assertFalse(self.view.visibleIdsEnabled())
        self.member.setProperties(visible_ids=True)
        self.assertFalse(self.view.visibleIdsEnabled())

    def testFailsWithMemberPropertyDisabled(self):
        # Should fail when member property is false
        self.member.setProperties(visible_ids=False)
        self.props.manage_changeProperties(visible_ids=True)
        self.assertFalse(self.view.visibleIdsEnabled())

    def testSucceedsWithMemberAndSitePropertyEnabled(self):
        # Should succeed only when site property and member property are true
        self.props.manage_changeProperties(visible_ids=True)
        self.member.setProperties(visible_ids=True)
        self.assertTrue(self.view.visibleIdsEnabled())
开发者ID:FemtoSistemas,项目名称:Products.CMFPlone,代码行数:28,代码来源:testPloneView.py

示例2: testGetParentObject

 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)
开发者ID:dtgit,项目名称:dtedu,代码行数:7,代码来源:testPloneView.py

示例3: TestVisibleIdsEnabled

class TestVisibleIdsEnabled(PloneTestCase.PloneTestCase):
    '''Tests the visibleIdsEnabled method'''

    def afterSetUp(self):
        self.view = Plone(self.portal, self.app.REQUEST)
        self.member = self.portal.portal_membership.getAuthenticatedMember()
        registry = getUtility(IRegistry)
        self.props = registry.forInterface(IEditingSchema, prefix="plone")

    def testFailsWithSitePropertyDisabled(self):
        # Set baseline
        self.member.setProperties(visible_ids=False)
        self.props.visible_ids = False
        # Should fail when site property is set false
        self.assertFalse(self.view.visibleIdsEnabled())
        self.member.setProperties(visible_ids=True)
        self.assertFalse(self.view.visibleIdsEnabled())

    def testFailsWithMemberPropertyDisabled(self):
        # Should fail when member property is false
        self.member.setProperties(visible_ids=False)
        self.props.visible_ids = True
        self.assertFalse(self.view.visibleIdsEnabled())

    def testSucceedsWithMemberAndSitePropertyEnabled(self):
        # Should succeed only when site property and member property are true
        self.props.visible_ids = True
        self.member.setProperties(visible_ids=True)
        self.assertTrue(self.view.visibleIdsEnabled())
开发者ID:ichim-david,项目名称:Products.CMFPlone,代码行数:29,代码来源:testPloneView.py

示例4: testGetCurrentFolder

    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,代码行数:30,代码来源:testPloneView.py

示例5: testGetParentObject

 def testGetParentObject(self):
     view = Plone(self.folder.test, self.app.REQUEST)
     self.assertEqual(view.getParentObject(), self.folder)
     # Make sure this looks only at containment
     self._invalidateRequestMemoizations()
     view = Plone(self.folder.test.__of__(self.portal), self.app.REQUEST)
     self.assertEqual(view.getParentObject(), self.folder)
开发者ID:JensenJiang,项目名称:Products.CMFPlone,代码行数:7,代码来源:testPloneView.py

示例6: CroppedDescription

 def CroppedDescription(self):
     registry = getUtility(IRegistry)
     length = registry.get("plone.search_results_description_length")
     plone_view = PloneView(None, None)
     if not length or not isinstance(length, int):
         # fallback if registry key is None
         length = 160
     return plone_view.cropText(self.flare.Description, length)
开发者ID:derFreitag,项目名称:collective.solr,代码行数:8,代码来源:contentlisting.py

示例7: testDisablePortlets

 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,代码行数:9,代码来源:testPloneView.py

示例8: testIsDefaultPageInFolder

 def testIsDefaultPageInFolder(self):
     view = Plone(self.folder.test, self.app.REQUEST)
     self.assertFalse(view.isDefaultPageInFolder())
     self.assertTrue(self.folder.canSelectDefaultPage())
     self.folder.setDefaultPage('test')
     # re-create the view, because the old value is cached
     self._invalidateRequestMemoizations()
     view = Plone(self.folder.test, self.app.REQUEST)
     self.assertTrue(view.isDefaultPageInFolder())
开发者ID:JensenJiang,项目名称:Products.CMFPlone,代码行数:9,代码来源:testPloneView.py

示例9: testIsDefaultPageInFolder

 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())
开发者ID:dtgit,项目名称:dtedu,代码行数:9,代码来源:testPloneView.py

示例10: testActionOverrideFromTemplate

 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,代码行数:14,代码来源:testPloneView.py

示例11: afterSetUp

 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()
开发者ID:dtgit,项目名称:dtedu,代码行数:7,代码来源:testPloneView.py

示例12: showEditableBorder

    def showEditableBorder(self):
        """Determine if the editable border should be shown - overridden 
        to suppress it for regular users on submission folders.
        Since people may add content it would show up otherwise.
        """

        context = aq_inner(self.context)
        if context.getPortalTypeName() != 'SubmissionFolder':
            return Plone.showEditableBorder(self)

        portal_membership = getToolByName(context, 'portal_membership')
        checkPerm = portal_membership.checkPermission

        if not checkPerm('Review portal content', context):
            return False

        return Plone.showEditableBorder(self)
开发者ID:raphael-ritz,项目名称:incf.abstractsubmission,代码行数:17,代码来源:ploneview.py

示例13: testIsFolderOrFolderDefaultPage

 def testIsFolderOrFolderDefaultPage(self):
     # an actual folder whould return true
     view = Plone(self.folder, self.app.REQUEST)
     self.assertTrue(view.isFolderOrFolderDefaultPage())
     # But not a document
     self._invalidateRequestMemoizations()
     view = Plone(self.folder.test, self.app.REQUEST)
     self.assertFalse(view.isFolderOrFolderDefaultPage())
     # Unless we make it the default view
     self.folder.setDefaultPage('test')
     self._invalidateRequestMemoizations()
     view = Plone(self.folder.test, self.app.REQUEST)
     self.assertTrue(view.isFolderOrFolderDefaultPage())
     # And if we have a non-structural folder it should not be true
     f = dummy.NonStructuralFolder('ns_folder')
     self.folder._setObject('ns_folder', f)
     self._invalidateRequestMemoizations()
     view = Plone(self.folder.ns_folder, self.app.REQUEST)
     self.assertFalse(view.isFolderOrFolderDefaultPage())
开发者ID:JensenJiang,项目名称:Products.CMFPlone,代码行数:19,代码来源:testPloneView.py

示例14: testIsFolderOrFolderDefaultPage

 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)
     self.failIf(view.isFolderOrFolderDefaultPage())
     # Unless we make it the default view
     self.folder.saveDefaultPage('test')
     del self.app.REQUEST.__annotations__
     view = Plone(self.folder.test, self.app.REQUEST)
     self.failUnless(view.isFolderOrFolderDefaultPage())
     # And if we have a non-structural folder it should not be true
     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.failIf(view.isFolderOrFolderDefaultPage())
开发者ID:dtgit,项目名称:dtedu,代码行数:19,代码来源:testPloneView.py

示例15: testIsPortalOrPortalDefaultPage

 def testIsPortalOrPortalDefaultPage(self):
     # an actual folder whould return true
     view = Plone(self.portal, self.app.REQUEST)
     self.assertTrue(view.isPortalOrPortalDefaultPage())
     # But not a document
     self.setRoles(['Manager'])
     self.portal.invokeFactory('Document', 'portal_test',
                               title='Test default page')
     self._invalidateRequestMemoizations()
     view = Plone(self.portal.portal_test, self.app.REQUEST)
     self.assertFalse(view.isPortalOrPortalDefaultPage())
     # Unless we make it the default view
     self.portal.setDefaultPage('portal_test')
     self._invalidateRequestMemoizations()
     view = Plone(self.portal.portal_test, self.app.REQUEST)
     self.assertTrue(view.isPortalOrPortalDefaultPage())
开发者ID:JensenJiang,项目名称:Products.CMFPlone,代码行数:16,代码来源:testPloneView.py


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