本文整理汇总了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)
示例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
示例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
}
示例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
示例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)
示例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
示例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()
示例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()}
示例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")]
示例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')]
示例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()
示例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()
示例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()}