本文整理汇总了Python中hydeengine.siteinfo.SiteInfo.find_resource方法的典型用法代码示例。如果您正苦于以下问题:Python SiteInfo.find_resource方法的具体用法?Python SiteInfo.find_resource怎么用?Python SiteInfo.find_resource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hydeengine.siteinfo.SiteInfo
的用法示例。
在下文中一共展示了SiteInfo.find_resource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_recent_posts
# 需要导入模块: from hydeengine.siteinfo import SiteInfo [as 别名]
# 或者: from hydeengine.siteinfo.SiteInfo import find_resource [as 别名]
def test_recent_posts(self):
site = SiteInfo(settings, TEST_SITE.path)
site.refresh()
self.generator = Generator(TEST_SITE.path)
self.generator.build_siteinfo()
self.generator.pre_process(site)
actual_resource = site.find_resource(File(site.content_folder.child('recent_posts.html')))
self.generator.process(actual_resource)
expected_text = File(
TEST_ROOT.child("recent_posts_dest.html")).read_all()
actual_text = actual_resource.temp_file.read_all()
assert expected_text == actual_text
示例2: test_render_direct
# 需要导入模块: from hydeengine.siteinfo import SiteInfo [as 别名]
# 或者: from hydeengine.siteinfo.SiteInfo import find_resource [as 别名]
def test_render_direct(self):
render_folder = TEST_SITE.child_folder('content/render');
render_folder.make()
template_folder = TEST_SITE.child_folder('layout');
template_folder.make()
File(TEST_ROOT.child("render_tag/template.html")
).copy_to(template_folder.child('render.html'))
source = File(TEST_ROOT.child("render_tag/source.html")).copy_to(render_folder)
site = SiteInfo(settings, TEST_SITE.path)
site.refresh()
self.generator = Generator(TEST_SITE.path)
self.generator.build_siteinfo()
self.generator.pre_process(site)
actual_resource = site.find_resource(source)
self.generator.process(actual_resource)
expected_text = File(TEST_ROOT.child("render_tag/dest.html")).read_all()
actual_text = actual_resource.temp_file.read_all()
if ORIGINAL_PRE_PROCESSORS:
settings.SITE_PRE_PROCESSORS = ORIGINAL_PRE_PROCESSORS
assert_html_equals(expected_text, actual_text)
示例3: test_filters
# 需要导入模块: from hydeengine.siteinfo import SiteInfo [as 别名]
# 或者: from hydeengine.siteinfo.SiteInfo import find_resource [as 别名]
def test_filters(self):
site = SiteInfo(settings, TEST_SITE.path)
for name in [".banjo", ".hidden", "junk.abc~"]:
f = File(site.content_folder.child(name))
self.files.append(f)
f.write("junk")
git = site.content_folder.child_folder(".git")
git_child = git.child_folder("child")
git_child_pack = File(git_child.child("pack"))
git.make()
git_child.make()
git_index = File(git.child("index"))
git_index.write("junk")
git_child_pack.write("junk")
original_exclude = settings.FILTER['exclude']
original_include = settings.FILTER['include']
settings.FILTER = {}
site = SiteInfo(settings, TEST_SITE.path)
site.refresh()
for f in self.files:
assert site.find_resource(f)
assert site.find_node(git)
assert site.find_resource(git_index)
assert site.find_node(git_child)
assert site.find_resource(git_child_pack)
settings.FILTER = {
'include': (),
'exclude': (".*","*~")
}
site = SiteInfo(settings, TEST_SITE.path)
site.refresh()
for f in self.files:
assert not site.find_resource(f)
assert not site.find_node(git)
assert not site.find_resource(git_index)
assert not site.find_node(git_child)
assert not site.find_resource(git_child_pack)
settings.FILTER = {
'include': (".banjo",),
'exclude': (".*","*~")
}
site = SiteInfo(settings, TEST_SITE.path)
site.refresh()
for f in self.files:
if f.name == ".banjo":
assert site.find_resource(f)
else:
assert not site.find_resource(f)
assert not site.find_node(git)
assert not site.find_resource(git_index)
settings.FILTER['exclude'] = original_exclude
settings.FILTER['include'] = original_include
self.files.append(git)