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


Python CMSToolbar.find_items方法代码示例

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


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

示例1: test_no_page

# 需要导入模块: from cms.toolbar.toolbar import CMSToolbar [as 别名]
# 或者: from cms.toolbar.toolbar.CMSToolbar import find_items [as 别名]
 def test_no_page(self):
     """
     Test that no page menu is present if request not in a page
     """
     from cms.toolbar.toolbar import CMSToolbar
     request = self.get_page_request(None, self.user, '/', edit=True)
     toolbar = CMSToolbar(request)
     toolbar.get_left_items()
     page_menu = toolbar.find_items(Menu, name='Page')
     self.assertEqual(page_menu, [])
开发者ID:Flimm,项目名称:djangocms-page-meta,代码行数:12,代码来源:test_toolbar.py

示例2: test_no_perm

# 需要导入模块: from cms.toolbar.toolbar import CMSToolbar [as 别名]
# 或者: from cms.toolbar.toolbar.CMSToolbar import find_items [as 别名]
 def test_no_perm(self):
     """
     Test that no page menu is present if user has no perm
     """
     from cms.toolbar.toolbar import CMSToolbar
     page1, page2 = self.get_pages()
     request = self.get_page_request(page1, self.user_staff, '/', edit=True)
     toolbar = CMSToolbar(request)
     toolbar.get_left_items()
     page_menu = toolbar.find_items(Menu, name='Page')
     self.assertEqual(page_menu, [])
开发者ID:Flimm,项目名称:djangocms-page-meta,代码行数:13,代码来源:test_toolbar.py

示例3: test_perm_permissions

# 需要导入模块: from cms.toolbar.toolbar import CMSToolbar [as 别名]
# 或者: from cms.toolbar.toolbar.CMSToolbar import find_items [as 别名]
 def test_perm_permissions(self):
     """
     Test that no page menu is present if user has general page Page.change_perm  but not permission on current page
     """
     from cms.toolbar.toolbar import CMSToolbar
     page1, page2 = self.get_pages()
     self.user_staff.user_permissions.add(Permission.objects.get(codename='change_page'))
     self.user_staff = User.objects.get(pk=self.user_staff.pk)
     request = self.get_page_request(page1, self.user_staff, '/', edit=True)
     toolbar = CMSToolbar(request)
     toolbar.get_left_items()
     page_menu = toolbar.find_items(Menu, name='Page')
     self.assertEqual(page_menu, [])
开发者ID:Flimm,项目名称:djangocms-page-meta,代码行数:15,代码来源:test_toolbar.py

示例4: test_toolbar

# 需要导入模块: from cms.toolbar.toolbar import CMSToolbar [as 别名]
# 或者: from cms.toolbar.toolbar.CMSToolbar import find_items [as 别名]
 def test_toolbar(self):
     """
     Test that PageTags/TitleTags items are present for superuser
     """
     from cms.toolbar.toolbar import CMSToolbar
     page1, page2 = self.get_pages()
     request = self.get_page_request(page1, self.user, '/', edit=True)
     toolbar = CMSToolbar(request)
     toolbar.get_left_items()
     page_menu = toolbar.find_items(Menu, name='Page')[0].item
     tags_menu = page_menu.find_items(SubMenu, name=force_unicode(PAGE_TAGS_MENU_TITLE))[0].item
     self.assertEqual(len(tags_menu.find_items(ModalItem, name="%s ..." % force_unicode(PAGE_TAGS_ITEM_TITLE))), 1)
     self.assertEqual(len(tags_menu.find_items(ModalItem)), len(self.languages)+1)
开发者ID:panosmm,项目名称:djangocms-page-tags,代码行数:15,代码来源:test_toolbar.py

示例5: test_perm

# 需要导入模块: from cms.toolbar.toolbar import CMSToolbar [as 别名]
# 或者: from cms.toolbar.toolbar.CMSToolbar import find_items [as 别名]
 def test_perm(self):
     """
     Test that page tags menu is present if user has Page.change_perm
     """
     from cms.toolbar.toolbar import CMSToolbar
     page1, page2 = self.get_pages()
     self.user_staff.user_permissions.add(Permission.objects.get(codename='change_page'))
     self.user_staff = User.objects.get(pk=self.user_staff.pk)
     request = self.get_page_request(page1, self.user_staff, '/', edit=True)
     toolbar = CMSToolbar(request)
     toolbar.get_left_items()
     page_menu = toolbar.find_items(Menu, name='Page')[0].item
     tags_menu = page_menu.find_items(SubMenu, name=force_unicode(PAGE_TAGS_MENU_TITLE))[0].item
     self.assertEqual(len(tags_menu.find_items(ModalItem, name="%s ..." % force_unicode(PAGE_TAGS_ITEM_TITLE))), 1)
开发者ID:panosmm,项目名称:djangocms-page-tags,代码行数:16,代码来源:test_toolbar.py

示例6: test_no_perm

# 需要导入模块: from cms.toolbar.toolbar import CMSToolbar [as 别名]
# 或者: from cms.toolbar.toolbar.CMSToolbar import find_items [as 别名]
 def test_no_perm(self):
     """
     Test that no page menu is present if user has no perm
     """
     from cms.toolbar.toolbar import CMSToolbar
     page1, __ = self.get_pages()
     request = self.get_page_request(page1, self.user_staff, '/', edit=True)
     toolbar = CMSToolbar(request)
     toolbar.get_left_items()
     page_menu = toolbar.find_items(Menu, name='Page')
     try:
         self.assertEqual(page_menu, [])
     except AssertionError:
         meta_menu = page_menu[0].item.find_items(SubMenu, name=force_text(PAGE_META_MENU_TITLE))
         self.assertEqual(meta_menu, [])
开发者ID:nephila,项目名称:djangocms-page-meta,代码行数:17,代码来源:test_toolbar.py

示例7: test_perm_permissions

# 需要导入模块: from cms.toolbar.toolbar import CMSToolbar [as 别名]
# 或者: from cms.toolbar.toolbar.CMSToolbar import find_items [as 别名]
 def test_perm_permissions(self):
     """
     Test that no page menu is present if user has general page Page.change_perm  but not permission on current page
     """
     from cms.toolbar.toolbar import CMSToolbar
     page1, __ = self.get_pages()
     self.user_staff.user_permissions.add(Permission.objects.get(codename='change_page'))
     self.user_staff = User.objects.get(pk=self.user_staff.pk)
     request = self.get_page_request(page1, self.user_staff, '/', edit=True)
     toolbar = CMSToolbar(request)
     toolbar.get_left_items()
     page_menu = toolbar.find_items(Menu, name='Page')
     try:
         self.assertEqual(page_menu, [])
     except AssertionError:
         meta_menu = page_menu[0].item.find_items(SubMenu, name=force_text(PAGE_META_MENU_TITLE))
         self.assertEqual(meta_menu, [])
开发者ID:nephila,项目名称:djangocms-page-meta,代码行数:19,代码来源:test_toolbar.py


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