本文整理匯總了Python中hyde.site.RootNode類的典型用法代碼示例。如果您正苦於以下問題:Python RootNode類的具體用法?Python RootNode怎麽用?Python RootNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了RootNode類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_node_relative_path
def test_node_relative_path():
s = Site(TEST_SITE_ROOT)
r = RootNode(TEST_SITE_ROOT.child_folder('content'), s)
assert not r.module
n = r.add_node(TEST_SITE_ROOT.child_folder('content/blog'))
assert n.relative_path == 'blog'
c = r.add_node(TEST_SITE_ROOT.child_folder('content/blog/2010/december'))
assert c.relative_path == 'blog/2010/december'
示例2: test_node_module
def test_node_module():
s = Site(TEST_SITE_ROOT)
r = RootNode(TEST_SITE_ROOT.child_folder('content'), s)
assert not r.module
n = r.add_node(TEST_SITE_ROOT.child_folder('content/blog'))
assert n.module == n
c = r.add_node(TEST_SITE_ROOT.child_folder('content/blog/2010/december'))
assert c.module == n
示例3: test_node_full_url_quoted
def test_node_full_url_quoted():
s = Site(TEST_SITE_ROOT)
s.config.base_url = 'http://localhost'
r = RootNode(TEST_SITE_ROOT.child_folder('content'), s)
assert not r.module
n = r.add_node(TEST_SITE_ROOT.child_folder('content/blo~g'))
assert n.full_url == 'http://localhost/' + quote('blo~g')
c = r.add_node(TEST_SITE_ROOT.child_folder('content/blo~g/2010/december'))
assert c.full_url == 'http://localhost/' + quote('blo~g/2010/december')
示例4: test_node_parent
def test_node_parent():
s = Site(TEST_SITE_ROOT)
r = RootNode(TEST_SITE_ROOT.child_folder('content'), s)
c = r.add_node(TEST_SITE_ROOT.child_folder('content/blog/2010/december'))
assert c.parent == r.node_from_relative_path('blog/2010')