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


Python Content.in_navigation方法代码示例

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


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

示例1: test_include_content_types

# 需要导入模块: from kotti.resources import Content [as 别名]
# 或者: from kotti.resources.Content import in_navigation [as 别名]
    def test_include_content_types(self):
        root = get_root()
        set_nav_setting('left', 'display_type', 'tree')
        set_nav_setting('left', 'options', ['stacked', 'include_root'])

        root[u'content_1'] = Content()
        root[u'content_2'] = Content()
        root[u'content_2'].in_navigation = False

        # If we include the content type the nav item is present.
        set_nav_setting('left', 'include', [Content.type_info.name])
        html = render_view(root, self.request, name='navigation-widget-tree')
        assert u'content_1' in html
        assert u'content_2' not in html

        # With an empty include_content_types, the nav item is not present.
        set_nav_setting('left', 'include', [])
        html = render_view(root, self.request, name='navigation-widget-tree')
        assert u'content_1' in html
        assert u'content_2' not in html

        # Again, with show_hidden True.
        set_nav_setting('left', 'options', ['stacked', 'include_root',
                                            'show_hidden_while_logged_in'])
        with patch('kotti_navigation.util.the_user', return_value='admin'):
            html = render_view(root, self.request,
                               name='navigation-widget-tree')
            assert u'content_1' in html
            assert u'content_2' in html
开发者ID:Kotti,项目名称:kotti_navigation,代码行数:31,代码来源:test_navigation.py

示例2: test_show_hidden

# 需要导入模块: from kotti.resources import Content [as 别名]
# 或者: from kotti.resources.Content import in_navigation [as 别名]
    def test_show_hidden(self):
        root = get_root()
        request = DummyRequest()
        root[u'content_1'] = Content()
        root[u'content_2'] = Content()
        root[u'content_2'].in_navigation = False

        # with standard settings the hidden nav points are hidden
        html = render_view(root, request, name='navigation-widget')
        assert u'content_1' in html
        assert u'content_2' not in html

        # if we change the setting, the nav points still hidden
        get_current_registry().settings['kotti_navigation.navigation_widget.show_hidden_while_logged_in'] = u'true'
        html = render_view(root, request, name='navigation-widget')
        assert u'content_1' in html
        assert u'content_2' not in html
开发者ID:igudym,项目名称:kotti_navigation,代码行数:19,代码来源:test_navigation.py

示例3: test_include_content_types

# 需要导入模块: from kotti.resources import Content [as 别名]
# 或者: from kotti.resources.Content import in_navigation [as 别名]
    def test_include_content_types(self):
        root = get_root()
        request = NavigationDummyRequest(path='/some-navigation-widget-left')
        root[u'content_1'] = Content()
        root[u'content_2'] = Content()
        root[u'content_2'].in_navigation = False

        # If we include the content type the nav item is present.
        se = get_current_registry().settings
        se['kotti_navigation.navigation_widget.left_include_content_types'] =\
            u'kotti.resources.Content'
        html = render_view(root, request, name='navigation-widget-tree-left')
        assert u'content_1' in html

        # With an empty include_content_types, the nav item is not present.
        se['kotti_navigation.navigation_widget.left_include_content_types'] =\
            u''
        html = render_view(root, request, name='navigation-widget-tree-left')
        assert u'content_1' in html
开发者ID:disko,项目名称:kotti_navigation,代码行数:21,代码来源:test_navigation.py

示例4: test_show_hidden

# 需要导入模块: from kotti.resources import Content [as 别名]
# 或者: from kotti.resources.Content import in_navigation [as 别名]
    def test_show_hidden(self):
        root = get_root()
        request = NavigationDummyRequest(path='/some-navigation-widget-left')
        root[u'content_1'] = Content()
        root[u'content_2'] = Content()
        root[u'content_2'].in_navigation = False

        # with standard settings the hidden nav items are hidden
        html = render_view(root, request, name='navigation-widget-tree-left')
        assert u'content_1' in html
        assert u'content_2' not in html

        # if we change the setting, the nav items still hidden
        se = get_current_registry().settings
        se['kotti_navigation.navigation_widget.left_show_hidden_while_logged_in'] =\
            u'true'
        html = render_view(root, request, name='navigation-widget-tree-left')
        assert u'content_1' in html
        assert u'content_2' not in html
开发者ID:disko,项目名称:kotti_navigation,代码行数:21,代码来源:test_navigation.py

示例5: test_show_hidden

# 需要导入模块: from kotti.resources import Content [as 别名]
# 或者: from kotti.resources.Content import in_navigation [as 别名]
    def test_show_hidden(self):
        root = get_root()
        set_nav_setting('left', 'display_type', 'tree')
        set_nav_setting('left', 'options', ['stacked', 'include_root'])

        root[u'content_1'] = Content()
        root[u'content_2'] = Content()
        root[u'content_2'].in_navigation = False

        # with standard settings the hidden nav items are hidden
        html = render_view(root, self.request, name='navigation-widget-tree')
        assert u'content_1' in html
        assert u'content_2' not in html

        # if we change the setting, the nav items still hidden
        set_nav_setting('left', 'options', ['tabs', 'stacked', 'include_root',
                                            'show_hidden_while_logged_in'])
        with patch('kotti_navigation.util.the_user', return_value='admin'):
            html = render_view(root, self.request,
                               name='navigation-widget-tree')
            assert u'content_1' in html
            assert u'content_2' in html
开发者ID:Kotti,项目名称:kotti_navigation,代码行数:24,代码来源:test_navigation.py


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