• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python menu_pool.discover_menus函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setUp

 def setUp(self):
     super(BaseMenuTest, self).setUp()
     if not menu_pool.discovered:
         menu_pool.discover_menus()
     self.old_menu = menu_pool.menus
     menu_pool.menus = {'CMSMenu': self.old_menu['CMSMenu']}
     menu_pool.clear(settings.SITE_ID)
开发者ID:Air51,项目名称:django-cms,代码行数:7,代码来源:menu.py


示例2: test_nav_extenders_invalid_type

 def test_nav_extenders_invalid_type(self):
     if not menu_pool.discovered:
         menu_pool.discover_menus()
     self.old_menu = menu_pool.menus
     menu_pool.menus = {'TestMenu': TestMenu()}
     self.assertRaises(AssertionError, create_page, navigation_extenders=1,
                       **self._get_default_create_page_arguments())
     menu_pool.menus = self.old_menu
开发者ID:Air-Mark,项目名称:django-cms,代码行数:8,代码来源:api.py


示例3: setUp

 def setUp(self):
     if not menu_pool.discovered:
         menu_pool.discover_menus()
     self.old_menu = menu_pool.menus
     menu_pool.menus = {
         'CMSMenu': self.old_menu['CMSMenu'],
         'TestMenu': TestMenu
     }
开发者ID:evildmp,项目名称:django-cms,代码行数:8,代码来源:test_navextender.py


示例4: test_nav_extenders_valid

 def test_nav_extenders_valid(self):
     if not menu_pool.discovered:
         menu_pool.discover_menus()
     self.old_menu = menu_pool.menus
     menu_pool.menus = {"TestMenu": TestMenu()}
     page = create_page(navigation_extenders="TestMenu", **self._get_default_create_page_arguments())
     self.assertEqual(page.navigation_extenders, "TestMenu")
     menu_pool.menus = self.old_menu
开发者ID:skirsdeda,项目名称:django-cms,代码行数:8,代码来源:test_api.py


示例5: setUp

 def setUp(self):
     super(BaseMenuTest, self).setUp()
     u = User(username="test", is_staff = True, is_active = True, is_superuser = True)
     u.set_password("test")
     u.save()
     self.login_user(u)
     if not menu_pool.discovered:
         menu_pool.discover_menus()
     self.old_menu = menu_pool.menus
     menu_pool.menus = {'CMSMenu':self.old_menu['CMSMenu']}
     menu_pool.clear(settings.SITE_ID)
开发者ID:AdrianRibao,项目名称:django-cms,代码行数:11,代码来源:menu.py


示例6: setUp

 def setUp(self):
     if not menu_pool.discovered:
         menu_pool.discover_menus()
     self.old_menu = menu_pool.menus
     # NOTE: if we're going to directly manipulate this menu pool, we should
     # at least be marking it as not _expanded.
     menu_pool.menus = {
         'CMSMenu': self.old_menu['CMSMenu'],
         'TestMenu': TestMenu
     }
     menu_pool._expanded = False
开发者ID:AaronJaramillo,项目名称:shopDPM,代码行数:11,代码来源:navextender.py


示例7: setUp

 def setUp(self):
     settings.CMS_MODERATOR = False
     u = User(username="test", is_staff = True, is_active = True, is_superuser = True)
     u.set_password("test")
     u.save()
     self.login_user(u)
     if not menu_pool.discovered:
         menu_pool.discover_menus()
     self.old_menu = menu_pool.menus
     menu_pool.menus = {'CMSMenu':self.old_menu['CMSMenu']}
     menu_pool.clear(settings.SITE_ID)
     self.create_some_nodes()
开发者ID:DrMeers,项目名称:django-cms-2.0,代码行数:12,代码来源:menu.py


示例8: setUp

 def setUp(self):
     
     with SettingsOverride(CMS_MODERATOR = False):
         u = User(username="test", is_staff = True, is_active = True, is_superuser = True)
         u.set_password("test")
         u.save()
         self.login_user(u)
         menu_pool.clear(settings.SITE_ID)
         
         if not menu_pool.discovered:
             menu_pool.discover_menus()
         self.old_menu = menu_pool.menus
         menu_pool.menus = {'CMSMenu':self.old_menu['CMSMenu'], 'TestMenu':TestMenu()}
开发者ID:42,项目名称:django-cms,代码行数:13,代码来源:navextender.py


示例9: setUp

    def setUp(self):
        super(MenuTest, self).setUp()
        self.cats = [self.category_1]
        for i, lang_data in enumerate(self._categories_data):
            cat = self._get_category(lang_data["en"])
            if "it" in lang_data:
                cat = self._get_category(lang_data["it"], cat, "it")
            self.cats.append(cat)

        activate("en")
        menu_pool.discover_menus()
        # All cms menu modifiers should be removed from menu_pool.modifiers
        # so that they do not interfere with our menu nodes
        menu_pool.modifiers = [m for m in menu_pool.modifiers if m.__module__.startswith("djangocms_blog")]
开发者ID:danra,项目名称:djangocms-blog,代码行数:14,代码来源:test_menu.py


示例10: setUp

    def setUp(self):
        super(MenuTest, self).setUp()
        self.cats = [self.category_1]
        for i, cat_data in enumerate(self.cat_data['en']):
            cat = self._get_category(cat_data)
            if i < len(self.cat_data['it']):
                cat = self._get_category(self.cat_data['it'][i], cat, 'it')
            self.cats.append(cat)

        activate('en')
        menu_pool.discover_menus()
        # All cms menu modifiers should be removed from menu_pool.modifiers
        # so that they do not interfere with our menu nodes
        menu_pool.modifiers = [m for m in menu_pool.modifiers if m.__module__.startswith('djangocms_blog')]
开发者ID:rmoorman,项目名称:djangocms-blog,代码行数:14,代码来源:test_menu.py


示例11: setUp

    def setUp(self):
        super(MenuTest, self).setUp()
        self.cats = [self.category_1]
        cache.clear()
        for i, lang_data in enumerate(self._categories_data):
            cat = self._get_category(lang_data['en'])
            if 'it' in lang_data:
                cat = self._get_category(lang_data['it'], cat, 'it')
            self.cats.append(cat)

        activate('en')
        menu_pool.clear(all=True)
        menu_pool.discover_menus()
        # All cms menu modifiers should be removed from menu_pool.modifiers
        # so that they do not interfere with our menu nodes
        menu_pool.modifiers = [m for m in menu_pool.modifiers if m.__module__.startswith('djangocms_blog')]
        cache.clear()
开发者ID:Darex1991,项目名称:djangocms-blog,代码行数:17,代码来源:test_menu.py


示例12: test_get_menus

    def test_get_menus(self):
        """
        Check that menus are dynamically loaded according to the different page the apphook is
        attached to
        """
        titles = self.create_base_structure('VariableUrlsApp', ['en', 'de'])
        titles[0].page.reverse_id = 'page1'
        titles[0].page.save()
        cache.clear()
        self.reload_urls()
        menu_pool.discover_menus()
        cache.clear()

        request = self.get_request('/')
        nodes = menu_pool.get_nodes(request)
        nodes_urls = [node.url for node in nodes]
        self.assertTrue(reverse('sample-account') in nodes_urls)
        self.assertFalse('/en/child_page/page2/' in nodes_urls)

        self.reload_urls()
        self.apphook_clear()

        cache.clear()
        self.reload_urls()

        page2 = create_page('page2', 'nav_playground.html',
                            'en', created_by=self.superuser, published=True,
                            parent=titles[0].page.get_draft_object().parent,
                            in_navigation=True,
                            apphook='VariableUrlsApp', reverse_id='page2')
        create_title('de', 'de_title', page2, slug='slug')
        page2.publish('de')
        request = self.get_request('/page2/')
        nodes = menu_pool.get_nodes(request)
        nodes_urls = [node.url for node in nodes]
        self.assertTrue(reverse('sample-account') in nodes_urls)
        self.assertTrue(reverse('sample2-root') in nodes_urls)
        self.assertTrue('/static/fresh/' in nodes_urls)

        self.apphook_clear()
开发者ID:intexal,项目名称:my-first-blog,代码行数:40,代码来源:test_apphooks.py


示例13: setUp

 def setUp(self):
     if not menu_pool.discovered:
         menu_pool.discover_menus()
     self.old_menu = menu_pool.menus
     menu_pool.menus = {"CMSMenu": self.old_menu["CMSMenu"], "TestMenu": TestMenu()}
开发者ID:alainwolf,项目名称:openbroadcast.org,代码行数:5,代码来源:navextender.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python menu_pool.get_nodes函数代码示例发布时间:2022-05-27
下一篇:
Python menu_pool.clear函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap