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


Python Node.root方法代码示例

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


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

示例1: test_public_publication

# 需要导入模块: from wheelcms_axle.node import Node [as 别名]
# 或者: from wheelcms_axle.node.Node import root [as 别名]
 def test_public_publication(self, client):
     """ published with explicit publication date """
     now = timezone.now()
     Type1(node=Node.root(), state="published", expire=None, publication=now - timedelta(hours=1)).save()
     public = Node.objects.public()
     assert public.count() == 1
     assert public[0] == Node.root()
开发者ID:reichertwd,项目名称:wheelcms_axle,代码行数:9,代码来源:test_node_manager.py

示例2: test_public_publish

# 需要导入模块: from wheelcms_axle.node import Node [as 别名]
# 或者: from wheelcms_axle.node.Node import root [as 别名]
 def test_public_publish(self, client):
     """ published without explicit expire/publication """
     Type1(node=Node.root(), state="published",
           expire=None, publication=None).save()
     public = Node.objects.public()
     assert public.count() == 1
     assert public[0] == Node.root()
开发者ID:wheelcms,项目名称:wheelcms_axle,代码行数:9,代码来源:test_node_manager.py

示例3: test_preferred_language_children

# 需要导入模块: from wheelcms_axle.node import Node [as 别名]
# 或者: from wheelcms_axle.node.Node import root [as 别名]
    def test_preferred_language_children(self, client):
        root = Node.root()
        sub = root.add("sub")

        root = Node.root(language="nl")
        child = root.children()[0]
        assert child.preferred_language == "nl"
开发者ID:reichertwd,项目名称:wheelcms_axle,代码行数:9,代码来源:test_node.py

示例4: test_node_equality

# 需要导入模块: from wheelcms_axle.node import Node [as 别名]
# 或者: from wheelcms_axle.node.Node import root [as 别名]
    def test_node_equality(self, client, root):
        sub = root.add("sub")
        sub_nl = Node.root(language="nl").children()[0]
        sub_en = Node.root(language="en").children()[0]

        assert sub_nl != sub_en
        assert sub_nl != sub

        sub.preferred_language = "nl"
        assert sub == sub_nl
开发者ID:wheelcms,项目名称:wheelcms_axle,代码行数:12,代码来源:test_node.py

示例5: test_rename_recursive_similar

# 需要导入模块: from wheelcms_axle.node import Node [as 别名]
# 或者: from wheelcms_axle.node.Node import root [as 别名]
 def test_rename_recursive_similar(self, client):
     """ renaming /aaa should't affect /aaaa """
     aaa = Node.root().add("aaa")
     aaaa = Node.root().add("aaaa")
     aa = Node.root().add("aa")
     bbb = aaaa.add("bbb")
     bb = aa.add("bb")
     aaa.rename("ccc")
     assert Node.objects.get(pk=bbb.pk).path == "/aaaa/bbb"
     assert Node.objects.get(pk=bb.pk).path == "/aa/bb"
开发者ID:reichertwd,项目名称:wheelcms_axle,代码行数:12,代码来源:test_node.py

示例6: test_clipboard_copy

# 需要导入模块: from wheelcms_axle.node import Node [as 别名]
# 或者: from wheelcms_axle.node.Node import root [as 别名]
    def test_clipboard_copy(self, client):
        root = Node.root()

        t1 = Type1(node=root.add("t1"), title="t1").save()
        t2 = Type1(node=root.add("t2"), title="t2").save()

        request = create_request("GET", "/")
        request.session['clipboard_copy'] = [t2.node.tree_path, t1.node.tree_path]

        toolbar = Toolbar(Node.root(), request, "view")
        clipboard = toolbar.clipboard()
        assert clipboard['count'] == 2
        assert clipboard['copy']
        assert not clipboard['cut']
        assert set(clipboard['items']) == set((t1, t2))
开发者ID:wheelcms,项目名称:wheelcms_axle,代码行数:17,代码来源:test_toolbar.py

示例7: test_change_slug_duplicate

# 需要导入模块: from wheelcms_axle.node import Node [as 别名]
# 或者: from wheelcms_axle.node.Node import root [as 别名]
 def test_change_slug_duplicate(self, client):
     """ change a slug """
     aaa = Node.root().add("aaa")
     aaa.add("bbb")
     node = aaa.add("bbb2")
     py.test.raises(DuplicatePathException, node.rename, "bbb")
     assert node.slug() == "bbb2"
开发者ID:reichertwd,项目名称:wheelcms_axle,代码行数:9,代码来源:test_node.py

示例8: test_duplicate_content_different_languages

# 需要导入模块: from wheelcms_axle.node import Node [as 别名]
# 或者: from wheelcms_axle.node.Node import root [as 别名]
 def test_duplicate_content_different_languages(self, client):
     """ two content objects for different languages
          can point to the same node """
     root = Node.root()
     child1 = root.add("n1")
     Type1(node=child1, language="nl").save()
     child1.set(Type1(language="fr").save())
开发者ID:reichertwd,项目名称:wheelcms_axle,代码行数:9,代码来源:test_content.py

示例9: test_duplicate_content

# 需要导入模块: from wheelcms_axle.node import Node [as 别名]
# 或者: from wheelcms_axle.node.Node import root [as 别名]
 def test_duplicate_content(self, client):
     """ two content objects for the same language 
          cannot point to the same node """
     root = Node.root()
     child1 = root.add("n1")
     Type1(node=child1, language="nl").save()
     pytest.raises(NodeInUse, lambda: child1.set(Type1(language="nl").save()))
开发者ID:reichertwd,项目名称:wheelcms_axle,代码行数:9,代码来源:test_content.py

示例10: test_simple

# 需要导入模块: from wheelcms_axle.node import Node [as 别名]
# 或者: from wheelcms_axle.node.Node import root [as 别名]
 def test_simple(self, client):
     """ simple case """
     root = Node.root()
     content = Type1(title="Hello World", state="published", node=root).save()
     spoke = content.spoke()
     feed = WheelFeed(spoke)
     assert content.content_ptr in feed.items()
开发者ID:wheelcms,项目名称:wheelcms_rss,代码行数:9,代码来源:test_rss.py

示例11: test_create_map

# 需要导入模块: from wheelcms_axle.node import Node [as 别名]
# 或者: from wheelcms_axle.node.Node import root [as 别名]
    def test_create_map(self, client):
        root = Node.root()
        r = root.add(langslugs=dict(fr="fr", en="en", nl="nl"))

        assert Node.get("/fr", language="fr") == \
               Node.get("/en", language="en") == \
               Node.get("/nl", language="nl") == r
开发者ID:reichertwd,项目名称:wheelcms_axle,代码行数:9,代码来源:test_translations.py

示例12: test_node_child

# 需要导入模块: from wheelcms_axle.node import Node [as 别名]
# 或者: from wheelcms_axle.node.Node import root [as 别名]
    def test_node_child(self, client):
        """ test the node.child method """
        translation.activate('en')
        root = Node.root()
        child = root.add("child")

        assert root.child("child") == child
开发者ID:reichertwd,项目名称:wheelcms_axle,代码行数:9,代码来源:test_translations.py

示例13: languages

# 需要导入模块: from wheelcms_axle.node import Node [as 别名]
# 或者: from wheelcms_axle.node.Node import root [as 别名]
def languages(request):
    if len(settings.LANGUAGES) <= 1:
        return None

    current_language = get_active_language()
    current_label = dict(settings.LANGUAGES).get(current_language,
                                                 current_language)

    res = []

    ld = getattr(settings, 'LANGUAGE_DOMAINS', {})

    for lang, label in settings.CONTENT_LANGUAGES:
        if lang == current_language:
            is_current = True
        else:
            is_current = False

        url = Node.root().get_absolute_url(language=lang)
        has_translation = False

        domain = ld.get(lang)
        if domain:
            protocol = "https" if request.is_secure() else "http"
            url = "%s://%s%s" % (protocol, domain, url)

        res.append(dict(id=lang, label=label, url=url,
                        has_translation=has_translation,
                        is_current=is_current))
    return dict(languages=dict(current=dict(id=current_language, label=current_label),
                languages=res))
开发者ID:wheelcms,项目名称:wheelcms_axle,代码行数:33,代码来源:context_processors.py

示例14: test_public_before_publication

# 需要导入模块: from wheelcms_axle.node import Node [as 别名]
# 或者: from wheelcms_axle.node.Node import root [as 别名]
 def test_public_before_publication(self, client):
     """ published content before publication """
     now = timezone.now()
     Type1(node=Node.root(), state="published",
           expire=None, publication=now + timedelta(hours=1)).save()
     public = Node.objects.public()
     assert public.count() == 0
开发者ID:wheelcms,项目名称:wheelcms_axle,代码行数:9,代码来源:test_node_manager.py

示例15: test_public_past_expire

# 需要导入模块: from wheelcms_axle.node import Node [as 别名]
# 或者: from wheelcms_axle.node.Node import root [as 别名]
 def test_public_past_expire(self, client):
     """ published content past expiration """
     now = timezone.now()
     Type1(node=Node.root(), state="published",
           expire=now - timedelta(hours=1), publication=None).save()
     public = Node.objects.public()
     assert public.count() == 0
开发者ID:wheelcms,项目名称:wheelcms_axle,代码行数:9,代码来源:test_node_manager.py


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