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


Python ISelectableConstrainTypes.setImmediatelyAddableTypes方法代码示例

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


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

示例1: testMoreNotIncludedWhenNotNecessary

# 需要导入模块: from Products.CMFPlone.interfaces import ISelectableConstrainTypes [as 别名]
# 或者: from Products.CMFPlone.interfaces.ISelectableConstrainTypes import setImmediatelyAddableTypes [as 别名]
 def testMoreNotIncludedWhenNotNecessary(self):
     constraints = ISelectableConstrainTypes(self.folder)
     constraints.setConstrainTypesMode(1)
     constraints.setLocallyAllowedTypes(('Document',))
     constraints.setImmediatelyAddableTypes(('Document',))
     actions = self.menu.getMenuItems(self.folder, self.request)
     self.assertEqual(len(actions), 2)
     self.assertEqual(actions[0]['extra']['id'], 'document')
     self.assertEqual(actions[1]['extra']['id'], 'settings')
开发者ID:pingviini,项目名称:plone.app.contentmenu,代码行数:11,代码来源:tests.py

示例2: testNonStructualFolderShowsParent

# 需要导入模块: from Products.CMFPlone.interfaces import ISelectableConstrainTypes [as 别名]
# 或者: from Products.CMFPlone.interfaces.ISelectableConstrainTypes import setImmediatelyAddableTypes [as 别名]
 def testNonStructualFolderShowsParent(self):
     self.folder.invokeFactory('Folder', 'folder1')
     directlyProvides(self.folder.folder1, INonStructuralFolder)
     constraints = ISelectableConstrainTypes(self.folder.folder1)
     constraints.setConstrainTypesMode(1)
     constraints.setLocallyAllowedTypes(('Document',))
     constraints.setImmediatelyAddableTypes(('Document',))
     actions = self.menu.getMenuItems(self.folder.folder1, self.request)
     self.assertEqual(len(actions), 0)
开发者ID:pingviini,项目名称:plone.app.contentmenu,代码行数:11,代码来源:tests.py

示例3: testMoreIncluded

# 需要导入模块: from Products.CMFPlone.interfaces import ISelectableConstrainTypes [as 别名]
# 或者: from Products.CMFPlone.interfaces.ISelectableConstrainTypes import setImmediatelyAddableTypes [as 别名]
 def testMoreIncluded(self):
     constraints = ISelectableConstrainTypes(self.folder)
     constraints.setConstrainTypesMode(1)
     constraints.setLocallyAllowedTypes(('Document', 'Image',))
     constraints.setImmediatelyAddableTypes(('Document',))
     actions = self.menu.getMenuItems(self.folder, self.request)
     self.failIf('image' in [a['extra']['id'] for a in actions])
     self.failUnless('document' in [a['extra']['id'] for a in actions])
     self.failUnless('more' in [a['extra']['id'] for a in actions])
     self.failUnless('settings' in [a['extra']['id'] for a in actions])
开发者ID:pingviini,项目名称:plone.app.contentmenu,代码行数:12,代码来源:tests.py

示例4: handleSave

# 需要导入模块: from Products.CMFPlone.interfaces import ISelectableConstrainTypes [as 别名]
# 或者: from Products.CMFPlone.interfaces.ISelectableConstrainTypes import setImmediatelyAddableTypes [as 别名]
    def handleSave(self, action):
        data, errors = self.extractData()

        if errors:
            return

        immediately_addable_types = [t for t in data['current_prefer']
                                     if t not in data['current_allow']]
        locally_allowed_types = data['current_prefer']
        aspect = ISelectableConstrainTypes(self.context)
        aspect.setConstrainTypesMode(data['constrain_types_mode'])
        aspect.setLocallyAllowedTypes(locally_allowed_types)
        aspect.setImmediatelyAddableTypes(immediately_addable_types)
开发者ID:starzel,项目名称:plone.app.content,代码行数:15,代码来源:constraintypes.py

示例5: testAddMenuWithNothingToAddButWithAvailableMorePage

# 需要导入模块: from Products.CMFPlone.interfaces import ISelectableConstrainTypes [as 别名]
# 或者: from Products.CMFPlone.interfaces.ISelectableConstrainTypes import setImmediatelyAddableTypes [as 别名]
 def testAddMenuWithNothingToAddButWithAvailableMorePage(self):
     constraints = ISelectableConstrainTypes(self.folder)
     constraints.setConstrainTypesMode(1)
     constraints.setLocallyAllowedTypes(('Document',))
     constraints.setImmediatelyAddableTypes(())
     self.folder.manage_permission('Modify constrain types', ('Manager',))
     setRoles(self.portal, TEST_USER_ID, ['Contributor'])
     items = self.menu.getMenuItems(self.folder, self.request)
     factoriesMenuItem = [i for i in items if
         i['extra']['id'] == 'plone-contentmenu-factories'][0]
     self.assertEqual(len(factoriesMenuItem['submenu']), 1)
     self.assertEqual(factoriesMenuItem['submenu'][0]['extra']['id'],
                      'plone-contentmenu-more')
开发者ID:starzel,项目名称:plone.app.contentmenu,代码行数:15,代码来源:test_menu.py

示例6: __call__

# 需要导入模块: from Products.CMFPlone.interfaces import ISelectableConstrainTypes [as 别名]
# 或者: from Products.CMFPlone.interfaces.ISelectableConstrainTypes import setImmediatelyAddableTypes [as 别名]
    def __call__(self):

        if hasattr(self.context.aq_base, CAROUSEL_ID):
            carousel = getattr(self.context, CAROUSEL_ID)
        else:
            pt = getToolByName(self.context, 'portal_types')
            newid = pt.constructContent(
                            type_name='Folder',
                            container=self.context,
                            id='carousel',
                            title='Carousel Banners'
                        )
            carousel = getattr(self.context, newid)

            # exclude the (Archetypes or Dexterity) folder from navigation
            if hasattr(aq_base(carousel), 'setExcludeFromNav'):
                carousel.setExcludeFromNav(True)
            elif hasattr(aq_base(carousel), 'exclude_from_nav'):
                carousel.exclude_from_nav = True

            # mark the new folder as a Carousel folder
            alsoProvides(carousel, ICarouselFolder)

            # make sure Carousel banners are addable within the new folder
            addPermissionsForRole(carousel, 'Manager',
                                  ('Carousel: Add Carousel Banner',))
            addPermissionsForRole(carousel, 'Site Administrator',
                                  ('Carousel: Add Carousel Banner',))
            addPermissionsForRole(carousel, 'Owner',
                                  ('Carousel: Add Carousel Banner',))
            addPermissionsForRole(carousel, 'Contributor',
                                  ('Carousel: Add Carousel Banner',))
            addPermissionsForRole(carousel, 'Editor',
                                  ('Carousel: Add Carousel Banner',))
            

            # make sure *only* Carousel banners are addable
            aspect = ISelectableConstrainTypes(carousel)
            aspect.setConstrainTypesMode(1)
            aspect.setLocallyAllowedTypes(['Carousel Banner'])
            aspect.setImmediatelyAddableTypes(['Carousel Banner'])

            carousel.reindexObject()

        self.request.RESPONSE.redirect(
            carousel.absolute_url() + '/@@edit-carousel'
        )
开发者ID:pabo3000,项目名称:Products.Carousel,代码行数:49,代码来源:manager.py

示例7: handleSave

# 需要导入模块: from Products.CMFPlone.interfaces import ISelectableConstrainTypes [as 别名]
# 或者: from Products.CMFPlone.interfaces.ISelectableConstrainTypes import setImmediatelyAddableTypes [as 别名]
    def handleSave(self, action):
        data, errors = self.extractData()
        if errors:
            self.status = self.formErrorsMessage
            return

        allowed_types = data['allowed_types']
        immediately_addable = [
            t for t in allowed_types
            if t not in data['secondary_types']]

        aspect = ISelectableConstrainTypes(self.context)
        aspect.setConstrainTypesMode(data['constrain_types_mode'])
        aspect.setLocallyAllowedTypes(allowed_types)
        aspect.setImmediatelyAddableTypes(immediately_addable)
        contextURL = self.context.absolute_url()
        self.request.response.redirect(contextURL)
开发者ID:urska19,项目名称:Plone-test,代码行数:19,代码来源:constraintypes.py

示例8: migrate_typerestriction

# 需要导入模块: from Products.CMFPlone.interfaces import ISelectableConstrainTypes [as 别名]
# 或者: from Products.CMFPlone.interfaces.ISelectableConstrainTypes import setImmediatelyAddableTypes [as 别名]
 def migrate_typerestriction(self):
     constraints = ISelectableConstrainTypes(self.new)
     constraints.setConstrainTypesMode(ENABLED)
     constraints.setImmediatelyAddableTypes(self.new_allowed)
     constraints.setLocallyAllowedTypes(self.new_allowed)
开发者ID:zestsoftware,项目名称:Products.eXtremeManagement,代码行数:7,代码来源:setuphandlers.py


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